Hi,

This post started as a request for help but has ended up as a FYI 
post.

I have quite a few jpegs with "extraneous bytes before marker 0xed".

The images can be opened in PS, IrfanView and browsers so the 
corruption is not fatal but, mostly as an exercise, I wanted to try 
and remove the error.

I could convert the files to remove the error but that would apply 
the encoding again and would lead to some, albeit minute,  
degradation of the image.

What I wanted was to do is open the files in a hex editor, find the 
marker, delete x number of bytes before the marker and save the 
image. 

Trying to find the hex value was a little tough. After doing a lot of 
searching for 'ed'  in Hex edit mode of WinVi32, the most obvious 
candidate looks like a section that reads like

00 00 00 00 ff ed 7d

Where 00 goes back about 30 lines. So the marker sequence to find was 
"ff ed 7d". In the 3 cases I looked at the extraneous bytes were null 
or 00. 

So to remove the extra bytes, highlight the first null characters 
prior to 'ff ed' back to the first occurrence of 00 in that sequence. 
Delete the highlighted section, save the file with a new name. Open 
it in a graphics package and run identify to check that the image is 
sane. If your happy, overwrite original corrupted file with your new 
version.

The only real benefit I have found in doing this is that graphics 
packages (namely PS) will open the file a little quicker. As far as I 
can tell this process has not tampered with any of the other file 
attributes such as ICC/IPTC/EXIF profiles and the preview image 
remains intact.

Away, HTH.
Dp.

_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to