0

I have this confusing problem when WebImage retrieves an image saved as ".jpg" it returns as ".png".

Here's the image of the problem:

png - jpg error

Any ideas why this is happening?

UPDATE: The lighthouse.jpg is one of the My Picture samples of Windows 7 and was uploaded and saved with no frills.

Here is my upload method when uploading the lighthouse.jpg which is saved with uploadImage.SaveAs(path);

upload method

Ron
  • 1,721
  • 1
  • 19
  • 43

2 Answers2

1

Without the respective image it is not possible to solve this 100% BUT the extension (in your case jpg) is by no means a guarantee that the file is actually in that file format... I suspect it is a PNG saved with the extension JPG...

Yahia
  • 69,653
  • 9
  • 115
  • 144
  • If it helps, the lighthouse.jpg is one of the sample images in Windows 7. And it was uploaded and saved with no frills as HttpPostedFileBase. – Ron Apr 02 '12 at 09:30
  • 1
    @Ron on my Win7 it has 1024x768 which leads me to assume that the *no frills* seems to be wrong (your has 550x412)... either before, during or after the upload the file has been changed... – Yahia Apr 02 '12 at 09:36
  • I updated my question with the upload method, and like i said i didn't do anything special to the uploaded image, just .SaveAs(). – Ron Apr 02 '12 at 09:41
  • 1
    @Ron thanks... this proves the fact that it has been changed - specifically AFTER the upload (you can see it has 1024x768 in the `Index` method while it has 550x412 in the other method!). – Yahia Apr 02 '12 at 09:43
  • 1
    That's in another method that processes the image which takes place AFTER getting the upload. The image was already .png to begin with (1024x768) even before processing. – Ron Apr 02 '12 at 09:47
  • 1
    @Ron sorry but you description is really confusing to me... you don't provide enough code to reproduce the behaviour AND you provide code the wrong way (screenshot) - you should provide code in the body of your question so that a copy&paste is possible... – Yahia Apr 02 '12 at 09:51
  • The screenshot's purpose was to show the properties. Thanks anyway. – Ron Apr 02 '12 at 09:55
0

The image's Mime type may be set differently to its file-suffix. Ref. https://stackoverflow.com/a/14587821/6812820

Zeek2
  • 386
  • 4
  • 8