Hi,
I have an application that requires me to use jpeg files without exif meta data.
Therefore, I used exiftool -all= ./img.jpg and exiftool -exif:all= ./image.jpg to delete it.
Now the problem is the app complains that in this file, the APP0 marker is missing.
This app has to automatically process the jpg file, more exactly to save it as TIFF
and it seems it needs some meta data in order to be able to do that, but such data is deleted too.
So I tried this approach:
exiftool -exif:all= --jfif:all ./img.jpg
exiftool -exif:all= -tagsfromfile @ -*Resolution ./img.jpg
but none work.
So question is how to delete the exif data but keep the needed meta info.
Any hints are appreciated.
The command you list doesn't remove the JFIF block, it only clears the EXIF block.
Example:
C:\>exiftool -g1 -a -s -exif:all -jfif:all Y:/!temp/st/test.jpg
---- JFIF ----
JFIFVersion : 1.01
ResolutionUnit : inches
XResolution : 72
YResolution : 72
---- IFD0 ----
Model : test
XResolution : 72
YResolution : 72
ResolutionUnit : inches
YCbCrPositioning : Centered
C:\>exiftool -P -overwrite_original -exif:all= Y:/!temp/st/test.jpg
1 image files updated
C:\>exiftool -g1 -a -s -exif:all -jfif:all Y:/!temp/st/test.jpg
---- JFIF ----
JFIFVersion : 1.01
ResolutionUnit : inches
XResolution : 72
YResolution : 72
Maybe you mean you want to remove all the EXIF data except the resolution tags? In that case you were close with your second command, you probably just needed to include the ResolutionUnit as well
C:\>exiftool -g1 -a -s -exif:all -jfif:all Y:/!temp/st/test.jpg
---- JFIF ----
JFIFVersion : 1.01
ResolutionUnit : inches
XResolution : 72
YResolution : 72
---- IFD0 ----
Model : test
XResolution : 72
YResolution : 72
ResolutionUnit : inches
YCbCrPositioning : Centered
C:\>exiftool -P -overwrite_original -exif:all= -TagsFromFile @ -*resolution* Y:/!temp/st/test.jpg
1 image files updated
C:\>exiftool -g1 -a -s -exif:all -jfif:all Y:/!temp/st/test.jpg
---- JFIF ----
JFIFVersion : 1.01
ResolutionUnit : inches
XResolution : 72
YResolution : 72
---- IFD0 ----
XResolution : 72
YResolution : 72
ResolutionUnit : inches
YCbCrPositioning : Centered
Or maybe the JFIF block didn't exist in the first place? In that case, you can recreate it with something like
exiftool -JFIF:*Resolution=300 -ResolutionUnit=Inches /path/to/file/
Also, be aware that none of these commands will remove metadata that is in the XMP or IPTC groups.
Thanks for the reply.
I just assumed it deleted resolution too and tried to keep it alive thinking it would fix the issue but it didn't work (it was just my assumption).
What is for sure is that the app returns the error message "APP0 marker is missing" and that it required JFIF
Is there any way to accomplish this? (delete exif data and keep JFIF data)
None of the above commands, yours or mine, delete the JFIF data. Are you sure it existed in the first place? Check the file out before and after with
exiftool -JFIF:all /path/to/file
If exiftool says it has the JFIF block and the program says it's missing, then the program is giving a misleading error and requires some other piece of data.
When I run this in cmd on original file (exiftool -JFIF:all /path/to/file) there is no data returned...
If it is possible to create a new JFIF block with at least the APP0 marker (holding even empty or dummy values, but just to be there), I would like to try that too...
You may create a new JFIF segment like this:
exiftool -jfif:xresolution=72 FILE
- Phil
Thanks; after deleting all exif data, I ran this command but the file wasn't updated. The message I get is:
Warning: Not creating JFIF in JPEG with Adobe APP14 - FILE
See this thread (https://exiftool.org/forum/index.php?topic=8695.0). Basically, since the image already has an Adobe APP14 block, adding a JFIF block might cause the image to be improperly rendered.
Here's the example images from that thread. The first is the original
(https://exiftool.org/forum/index.php?action=dlattach;topic=8695.0;attach=2266)
Then when the JFIF is added when there is an Adobe APP14 block already in the image.
(https://exiftool.org/forum/index.php?action=dlattach;topic=8695.0;attach=2268)
@StarGeek: Nice digging to find that old thread!
- Phil
Thanks, that is quite interesting.
It's true, I'm using Photoshop to create/save the files.
So if the file is made with Adobe, it can't be converted to jfif by any means..?
Actually, I've got some more concrete feedback about the needed file.
And these are the only mandatory specifications:
- Must be JFIF
- Must have APP0 marker
- Must NOT have markers APP1-APP15
Can't marker 15 be deleted entirely?
Do you mean APP14? Delete this with -adobe:all=
- Phil
OK, please check the attached file img_orig.jpg.
I applied these actions:
-exif:all=
-adobe:all=
-JFIF:xresolution=72
and in the end I got the file img_done.jpg
Then they tell me that the image still contains markers APP13, APP1, APP2
Isn't there a way to clear all these markers (except APP0), in one go?
To delete all but JFIF, do this: -all= -adobe:all= --jfif:all
- Phil
Thank you, it seems I'm closer now.
The only error I get now is that "APP0 marker is missing" .
Is it possible to avoid deleting of only this marker, or, to re-create it again after deleting all...?
The APP0 marker is the JFIF segment. I have already shown you a command that will recreate this.
- Phil
Thanks, now it works. That is what I was looking for!
Just one more thing I want to check if you can help - when you use argument -jfif:xresolution=72 it forces this resolution even though the real one may be different.
After all the processing, with --list I can see the "Image Width: 1132" and "Image Height: 726" information, which is the real one.
Still, wouldn't it be better not to force resolution in APP0 to avoid possible conflicts or confusions?
Is there a way to create the -jfif without specifying the resolution?
Or, is it that it doesn't actually matter what value the resolution is set to...?
Resolution is not the image width/height. It's the DPI to be initially used. For example, adding it to a Doc file, it will be used to determine the starting size of the image on the page.
As StarGeek said, and as I have been trying (unsuccessfully) to explain, you should try to understand the difference between resolution (pixels/inch) and image size (number of pixels).
- Phil
OK, thanks, got it.
So this actually doesn't matter. As long as number of pixels is kept unchanged, a higher resolution means a smaller size (in inches) and vice-versa, so it doesn't actually matter, right?
Thanks Phil, you did a good job explaining, thumbs up.
Same for you StarGeek! ;)
YES! By Jove, I think he's got it! :)
- Phil
Edit: Sorry, I was thinking of this thread (https://exiftool.org/forum/index.php?topic=11102.0) when I wrote these last two responses. Scriptero had a similar misunderstanding, and that was the thread in which I was trying in vain to explain the meaning of the resolution tags. You're (thankfully!) a lot quicker than him.