ExifTool Forum

ExifTool => Newbies => Topic started by: Scriptero on April 23, 2020, 08:25:39 PM

Title: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 23, 2020, 08:25:39 PM
Hello,
I sang the praises of exiftool too early.
Is there a way to maintain the resolution of the jpeg files?
I did several jpgs with 300dpi resolution and to my dismay i received 72dpi degradation. Now I have figure out how deep is the damage because i did not retain the originals. Please help. I know I shukd have checked.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: StarGeek on April 23, 2020, 08:42:06 PM
Exiftool does not affect the image in any way.  It has no ability to do so.

What happened is that whatever command you used removed the embedded XResolution and YResolution tags.  You can easily reset those, though the problem is figuring out which of the many resolution tags the program you are using to see them is actually reading.

Try this.  If the file is not a jpeg, drop the jfif part.
exiftool -jfif:*resolution=300 -exif:*resolution=300 /path/to/files/

Understand, the X/YResolution of an image is not a property of the image like the width or height of the image.  It can be changed without affecting the actual image in any way.

If you show us the command you used, we can tell you how to avoid changing the resolution tags.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Phil Harvey on April 23, 2020, 09:08:25 PM
StarGeek is correct, but add -resolutionunit=inches to his suggested command.

- Phil
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 23, 2020, 10:06:25 PM
Quote from: Phil Harvey on April 23, 2020, 09:08:25 PM
StarGeek is correct, but add -resolutionunit=inches to his suggested command.

- Phil

Thanks Harvey. I haven't noticed the error on psds or tifs. My script is:
exiftool  -r -all= -ext jpg -ext pdf -ext ai -ext png -ext tif -ext psd overwrite_original
I wasn't aware that there is a dimension md tag that would actually alter the resolution.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 24, 2020, 12:11:41 AM
Quote from: StarGeek on April 23, 2020, 08:42:06 PM
Exiftool does not affect the image in any way.  It has no ability to do so.

What happened is that whatever command you used removed the embedded XResolution and YResolution tags.  You can easily reset those, though the problem is figuring out which of the many resolution tags the program you are using to see them is actually reading.

Try this.  If the file is not a jpeg, drop the jfif part.
exiftool -jfif:*resolution=300 -exif:*resolution=300 /path/to/files/

Understand, the X/YResolution of an image is not a property of the image like the width or height of the image.  It can be changed without affecting the actual image in any way.

If you show us the command you used, we can tell you how to avoid changing the resolution tags.
Thanks Harvey. Sorry for the double post. I haven't noticed the error on psds or tifs. My script is:
exiftool  -r -all= -ext jpg -ext pdf -ext ai -ext png -ext tif -ext psd overwrite_original
I assume remove -all would keep my 300dpi jpg unaltered.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: StarGeek on April 24, 2020, 01:17:50 AM
You can copy the resolution tags back into the file after the -all=.

exiftool -r -all= -TagsFromFile @ -*resolution* -ext jpg -ext pdf -ext ai -ext png -ext tif -ext psd -overwrite_original /path/to/files/
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Phil Harvey on April 24, 2020, 06:50:19 AM
Note that -all= will not remove all metadata from PDF, AI or TIFF files.

- Phil
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 24, 2020, 10:07:04 AM
I only need to remove the IPTC keywords.
I I don't know how the resolution is being changed. Can i use -iptc instead of -all.
I am sorry, I'm just desperate to get rid od Adobe Bridge, exiftool is soo much faster.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: StarGeek on April 24, 2020, 10:45:58 AM
Quote from: Scriptero on April 24, 2020, 10:07:04 AM
I only need to remove the IPTC keywords.

Then use
exiftool -Keywords= -Subject= -HierarchicalSubject= <FileOrDir>

QuoteI I don't know how the resolution is being changed.

It's being changed because -All= removes the above mentioned Resolution tags.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 24, 2020, 12:08:09 PM
Awesome! Let me try that and post back.
It makes sense that -all would do that.
Thanks.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 24, 2020, 09:34:15 PM
The solutions so far do not seem to work.
Perhaps I need to explain further.
I have a folder with several nested folders full of .pdf, .psd, .tif, .jpg .ai. when i applied the script above (exiftool  -all -ext pdf...) it worked wonderfully except that it reduced the size of the jpg and png at 300dpi to 72dpi. What I've been given so far doesn't work. I entered the text as Phil recommended but i get directories scanned but 0 image files read. Sorry for my peskyness, maybe exiftool is not the tool I need...thanks
Title: Re: Exiftool reduces the resolution of jpgs
Post by: StarGeek on April 24, 2020, 10:53:28 PM
Quote from: Scriptero on April 24, 2020, 09:34:15 PM
I have a folder with several nested folders full of .pdf, .psd, .tif, .jpg .ai. when i applied the script above (exiftool  -all -ext pdf...) it worked wonderfully except that it reduced the size of the jpg and png at 300dpi to 72dpi.

Worked in what way? What didn't work with the other commands?  What are you actually trying to do?  We really need to know a lot more details in order to help you.

Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 25, 2020, 02:39:41 AM
I was able to remove the metadata iptc keywords from all the files.
What didn't work was that exiftool converted the resolution of the files from 300dpi to 72dpi. I don't know what else I'm missing in my explanation...
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Phil Harvey on April 25, 2020, 06:32:56 AM
First, ExifTool only does what you tell it to do.  It won't change the "resolution" unless you tell it.

Second, the "resolution" information has nothing to do with the actual pixel resolution of the image.  ExifTool will never change the pixel dimensions of an image.  The "resolution" tags are only used by some software in order to determine what scaling to use for displaying the image.  If you specify an output size when printing, then the size you specify completely determines the resolution, and the "resolution" tags will be ignored.

Third, you haven't given us enough information to be able to help you:

What were the exact ExifTool commands that you are using?

Why do you say the resolution is now 72 dpi?  What software are you using to determine this?

Have you used ExifTool to look at the resolution tags?  What does it show?

- Phil
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 25, 2020, 07:38:32 PM
Simple. I have a .png and a .jpg with 300dpi res. I ran exiftool on my mac terminal with the -all tag. My assumption,
like you say, is that it will remove all the metadata without altering the files resolution. The resolution of the "clean" files where 72dpi!!! To make this conversation shorter, try for yourself and post back your results. Thanks
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 25, 2020, 07:46:33 PM
Btw i am using photoshop jpgs and pngs.
I used photoshop to check the files resolution. I'm using a mac terminal. My script, again, is: exiftool -r -all -ext jpg -ext png destination. I I don't know what other detail I'm missing, oh yeah, I am frustrated...?
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Phil Harvey on April 25, 2020, 09:11:38 PM
Quote from: Scriptero on April 25, 2020, 07:38:32 PM
My assumption, like you say, is that it will remove all the metadata without altering the files resolution. The resolution of the "clean" files where 72dpi!!! To make this conversation shorter, try for yourself and post back your results. Thanks

Yes.  I got this.  And as we said, using -all= will delete the resolution metadata.  But this doesn't affect the image.  And it doesn't set the resolution to 72 dpi either.  Whatever software you are using is assuming 72 dpi as the default resolution for an image with no resolution tags.  Just add these tags back as we showed you and all will be good.

This isn't a big deal.  The resolution tags are essentially meaningless anyway, for the reason I mentioned.

- Phil
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Alan Clifford on April 26, 2020, 07:47:23 AM
When you see the resolution tag, you are just seeing a piece of text.  It has nothing to do with the size, quality, whatever of the actual image.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 26, 2020, 05:56:48 PM
Can i do it all in one line?
Remove the keywords and retain the res tags. I apologize for my denseness.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Phil Harvey on April 26, 2020, 06:13:14 PM
Yes.  StarGeek provided that command for you.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 27, 2020, 08:22:48 PM
Quote from: StarGeek on April 24, 2020, 01:17:50 AM
You can copy the resolution tags back into the file after the -all=.

exiftool -r -all= -TagsFromFile @ -*resolution* -ext jpg -ext pdf -ext ai -ext png -ext tif -ext psd -overwrite_original /path/to/files/

Stargeek,

I tried the script the way it is written, I cut n pasted into terminal but I got the same results. Is the syntax correct?
I'm wondering if I have an extra space or one too many wildcards? I looked at both original and after exiftool and again the clean file reads 72dpi in photoshop.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Phil Harvey on April 27, 2020, 09:03:30 PM
What is the output of this command on a file before and after you ran StarGeek's command?:

exiftool -*resolution* -G1 -a FILE

- Phil
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 27, 2020, 10:28:56 PM
Nope. 72.
Keep in mind, I am looking at info size in photoshop. After exiftool magic i get 72... :(
Title: Re: Exiftool reduces the resolution of jpgs
Post by: StarGeek on April 28, 2020, 12:27:45 AM
Please run the command Phil asked and post the output here.  We can't figure out what the problem might be without it.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 28, 2020, 12:02:30 PM
As I explained earlier, I ran the exiftool command on my terminal on my mac running os sierra 10.12.6
"exiftool -r -all= -TagsFromFile @ -*resolution* -ext png --overwrite_original Test folder" I have a test folder with 3 .png files which are 300dpi at different pixel sizes.
After running that script, the results are that all 3 files get scanned and updated.
I checked the files in the info field in Photoshop and it reads 72dpi and the pixel size for ALL are 645x153.
Not only that the file dimensions are also changed.
Contrary to the statements here in this forum, the issue is that the "-all" DOES alter not only the dimensions of the file but the resolution as well.

I'm surprised that something soooo basic has not been addressed before.
Could someone do what I just did and come up with a practical solution instead of offering useless suggestions, like Phil's comment: "...And as we said, using -all= will delete the resolution metadata.  But this doesn't affect the image.  And it doesn't set the resolution to 72 dpi either.
Well...I just did and i challenge anyone in this forum.
Create a .png file at specific size above 72 dpi. Run the exiftool with the -all tag and you WILL discover that the file size and resolution has changed. This is getting too frustrating for me...
Title: Re: Exiftool reduces the resolution of jpgs
Post by: StarGeek on April 28, 2020, 12:51:23 PM
Quote from: Scriptero on April 28, 2020, 12:02:30 PM
As I explained earlier, I ran the exiftool command on my terminal on my mac running os sierra 10.12.6

We understand that.  But Phil just asked you a couple posts above (https://exiftool.org/forum/index.php?topic=11102.msg59463#msg59463) this one to run a different command and post the results so that we can see where the problem might be.  You did not do so.

QuoteContrary to the statements here in this forum, the issue is that the "-all" DOES alter not only the dimensions of the file but the resolution as well.

It does not alter the dimensions of the image.  Open up the file in an image viewer.  Look at the image dimensions in finder
(https://cdn.osxdaily.com/wp-content/uploads/2011/05/show-image-dimensions-finder-mac.jpg)
Look at the pixel dimensions in PS
(https://pe-images.s3.amazonaws.com/basics/cc/image-size-resolution/pixels-imagesize-resolution/photoshop-pixel-dimensions.png)
You will see that the image size is the same. You will see that they have not changed.

QuoteCould someone do what I just did and come up with a practical solution instead of offering useless suggestions

We are trying but you are not cooperating when we ask you to run a command so we can see what data needs to be copied.

Read about the The 72 PPI Web Resolution Myth (https://www.photoshopessentials.com/essentials/the-72-ppi-web-resolution-myth/) to understand the situation better.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 28, 2020, 12:55:16 PM
I give up. Thank you.
More than what i have stated above I don't know what else to say.
I am removing exiftool from my toolbar. Good luck!
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Scriptero on April 28, 2020, 12:56:30 PM
I meant toolbox.
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Phil Harvey on April 28, 2020, 01:33:22 PM
Thank you
Title: Re: Exiftool reduces the resolution of jpgs
Post by: sevy on April 28, 2020, 01:42:06 PM
QuoteCreate a .png file at specific size above 72 dpi. Run the exiftool with the -all tag and you WILL discover that the file size and resolution has changed. This is getting too frustrating for me...

I'm not an expert but I did it !
Here are the property tab of 3 files :
(a) source : I scanned a document, 300dpi (+/- A4 page)
(b) your command is run : it was not indicated but it was 72 dpi (see the print size change)
(c) I manually change 72dpi to 300 dpi with XnView (my default tool).

I do not see any difference between (a) and (c).

I had a similar problem with another tool (ImageCompositeEditor ICE) : I need to scan a document larger than possible (my purpose was to have a pdf file) with my flatbed scanner, so I scan this document in 2 parts (each 300 dpi png). Then I created a new document with ICE. The result was a.. 72 dpi png file :-(
I only had to manually change the resolution with XnView (also possible with other tools) and the result was ok.

I'm not an ExifTool specialist but I used it - with pleasure - to add metadata to jpg/pdf files for many years and until now, I never encountered your problem (but may be I don't understand it very well as English is not my primary language.)



Title: Re: Exiftool reduces the resolution of jpgs
Post by: StarGeek on April 28, 2020, 02:32:52 PM
sevy, would you mind sharing (or creating a new) image for all three of your steps so we can figure out the tags the hold the resolution in case someone comes along at a later time looking to solve a similar problem?
Title: Re: Exiftool reduces the resolution of jpgs
Post by: sevy on April 28, 2020, 03:02:44 PM
no problem, how do you want to receive the files ?
Title: Re: Exiftool reduces the resolution of jpgs
Post by: StarGeek on April 28, 2020, 03:47:01 PM
Got the files, thank you sevy.

I can't be completely sure as Adobe Bridge doesn't appear to show a resolution for PNG files, at least I can't find one, and my Lightroom is so old that it doesn't even load PNG files, but it looks like the resolution is in the PNG-pHYs group.  Specifically, the PixelsPerUnitX, PixelsPerUnitY, and PixelUnits tags.
C:\>exiftool -g1 -a -s -PNG-pHYs:all Y:\!temp\st -ext png
======== Y:/!temp/st/01_300dpi.png
---- PNG-pHYs ----
PixelsPerUnitX                  : 11811
PixelsPerUnitY                  : 11811
PixelUnits                      : meters
======== Y:/!temp/st/01_300dpi_et.png
======== Y:/!temp/st/02_300dpi_et_manual change.png
---- PNG-pHYs ----
PixelsPerUnitX                  : 11811
PixelsPerUnitY                  : 11811
PixelUnits                      : meters
    1 directories scanned
    3 image files read


So, to add onto the original command
exiftool -r -all= -TagsFromFile @ -*resolution* -PNG-pHYs:all -ext jpg -ext pdf -ext ai -ext png -ext tif -ext psd -overwrite_original /path/to/files/

Thanks again for the help, sevy
Title: Re: Exiftool reduces the resolution of jpgs
Post by: Phil Harvey on April 28, 2020, 08:03:36 PM
Nice.  Well done.