Exiftool reduces the resolution of jpgs

Started by Scriptero, April 23, 2020, 08:25:39 PM

Previous topic - Next topic

Scriptero

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.

StarGeek

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

StarGeek is correct, but add -resolutionunit=inches to his suggested command.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Scriptero

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.

Scriptero

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.

StarGeek

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/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Note that -all= will not remove all metadata from PDF, AI or TIFF files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Scriptero

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.

StarGeek

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Scriptero

Awesome! Let me try that and post back.
It makes sense that -all would do that.
Thanks.

Scriptero

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

StarGeek

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.

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Scriptero

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...

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Scriptero

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