Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Someone emailed me an image. I see it in Gmail, and I can see it in a browser, but when I try to open it up on Photoshop, I get an error saying:

Could not open "XYZ.jpg" because an unknown or invalid JPEG marker is found.

Does anyone know what is the issue or if there is a workaround?

share|improve this question
    
Perhaps it is not actually a JPEG file? In Firefox, you can right-click an image and view its properties to confirm the file type. – Paul Lammertsma Sep 11 '11 at 14:52
    
Take a screenshot of your browser (press PrintScreen or use an 3rd party program), and then paste it into a blank image in Photoshop. If the image is large, it might take some stitching. – dbkk101 Sep 11 '11 at 14:55
    
@Paul Lammertsma - it seems that all other image tools (paint.net, etc all seems to open it fine as a jpeg) – leora Sep 11 '11 at 14:55
    
Perhaps those other applications discovered that the file is not in fact a JPEG, but a PNG, for instance. – Paul Lammertsma Sep 11 '11 at 15:01
    
@ooo Which version of PhotoShop are you using? – Alpine Sep 11 '11 at 15:02
up vote 3 down vote accepted

Use Irfanview to open the image, if it is not actually a JPEG, Irfanview will tell you and ask if you want to change the extension to the correct one.

You could also save it as a BMP from Irfanview, it should open in any application then.

share|improve this answer

Admittedly this is a little abstruse, but open the file in a hex editor. In a hex editor, all examples of a given graphic file type will invariably begin with the same characters. If your file doesn't begin with

ff d8 ff e0 00 10 4a 46 49 46  |  ÿØÿà..JFIF

it isn't a .jpeg. Change the extension accordingly. If it actually is a .jpeg, then there is some other issue.

Here's a list of common file types:

.tif, .tiff

49 49 2a  |  II*

.jpg, .jpeg

ff d8 ff e0 00 10 4a 46 49 46  |  ÿØÿà..JFIF

.png

89 50 4e 47  |  .PNG

.bmp

42 4d 38  |  BM8

.gif

47 49 46 38 39 61  |  GIF89a

.psd

38 42 50 53  |  8BPS

.pdf

25 50 44 46 2d 31 2e 36 0d 25 e2 e3 cf d3  |  %PDF-1.6.%âãÏÓ
share|improve this answer

The simple solution would be to copy the image from your browser and paste it into a new document in Photoshop.

share|improve this answer

Try drag and dropping the image in a web browser.
After the browser opens the image, right click and save the image.
Then try opening it in Photoshop.


Another method:
You said that you can open it in paint.NET, you can open the image in paint.NET and do save as... and save it as a new file.
Then try opening that new file in Photoshop.

share|improve this answer
    
that is what i tried in the first place. no such luck – leora Sep 11 '11 at 15:36
    
@ooo You said that you can open it in paint.NET, you can open the image in paint.NET and do save as... and save it as a new file. Then try opening that new file in Photoshop. – Alpine Sep 11 '11 at 15:41

Here is a way I found around this problem.

This is for Windows I assume you can find an equivalent with MAC using this method.

Right Click the JPG Choose Open With > Windows Picture and Fax Viewer Then Copy to (Or Save As) and rename the jpg file and save

Open with Photoshop

share|improve this answer
    
this will reencode the file, which will lower it's quality – bortao Sep 21 '11 at 4:16
    
Depending on your use of the file this may not be an issue, I use it on a case by case basis when I run into this issue. – L84 Sep 21 '11 at 5:29

Here's another workaround if you aren't able to determine the image's correct format.

Generally speaking, if you can open it in a browser, you should be able to right-click and "Save Image As". Your browser should automatically detect the image's file format. Saving and editing should then be straightforward.

share|improve this answer

You could try to find out the mime type. A normal webbrowser should show you that in the image properties... Then you can find out which real filetype you've got!

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .