Remove segments before JFIF

Started by TheDoc, November 05, 2020, 02:32:23 PM

Previous topic - Next topic

TheDoc

HI,

hopefully this hasn't been answered before - but a search didn't turn up anything.

I have some software that adds its own segment into my jpgs before the JFIF segment. So the file looks like:

Standard jpg start


ff d8


Add. segment


ff fe 20 64 65 6e 66 75 73 65 64 20 66 72 6f 6d 20 20 27 49 4d 47 5f 33 37 37 31 5f 45 4f 53 2e 4a 50 47 27 20 27 49 4d 47 5f 33 37 37 30 5f 45 4f 53 2e 4a 50 47 27 20 27 49 4d 47 5f 33 37 37 32 5f 45 4f 53 2e 4a 50 47 27 20 4c 56 20 72 61 6e 67 65 20 20 31 31 2e 37 20 20 31 32 2e 34 20 20 31 31 2e 30 20


JFIF segment


ff e0 20 10 4a 46 49 46  ...


And now some other software can't read the image anymore.

Question: Is there any exiftool command that would allow to remove this additional segment? Unfortunately, I wasn't able to deduce a tag type from "FF FE". Maybe its a known one that I could simply extract from the file?

EDIT: I'm aware of "How do I repair corrupted EXIF?" from the FAQ. I was hoping to find a more specific solution to my problem :-)

Thanks in advance,
Thomas

StarGeek

I believe that 0xFFF8 is the start of a jpeg comment.  When you run exiftool on the file, do you see something like
Comment                         : denfused from  'IMG_3771_EOS.JPG' 'IMG_3770_EOS.JPG' 'IMG_3772_EOS.JPG' LV range  11.7  12.4  11.0

If so, you can remove the comment with
exiftool -comment= /path/to/file/
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

TheDoc

Thanks for the tip! That has made me look into the data a bit longer.

The text appears to be IFD0, ImageDescription. After exiftool -all= -tagsfromfile @ -all:all -unsafe -icc_profile the data is still there, only at the correct position. So this seems to be a good way to fix without loosing any data. Now I only need to limit the rebuild to files with this tag, e.g. by -if "defined $ImageDescription"?