Exiftool fail to get xresolution and yresolution from jpg

Started by GeoVan, March 04, 2024, 10:56:36 AM

Previous topic - Next topic

GeoVan

Exiftool fail to get xresolution and yresolution from jpg while windows explorer shows them.
Here is the windows explorer RIGHT click -> Properies of the jpg file:
windows explorer right click.jpg


But using the exiftool command:
exiftool.exe  -XResolution  -yResolution input.jpg     ----> (provided that i name the file as input.jpg)
I get the following:
exiftool commandline.jpg


Also the exiftoolgui gives the following:
exiftoolgui.jpg

As shown above, it is very strange why exiftool can not "read" what windows explorer can "read" regarding image RESOLUTION.
It gives value 1 instead of the correct value 96.
Why this , please?
How can we solve this, please?

StarGeek

See the Windows Metadata thread.

96 is Windows default horizontal and vertical resolution and that is what will appear when it doesn't find a tag it reads to fill those properties.  As of my last test (April 2023, Windows 10), it will only read one tag to fill each of those properties, those being the EXIF:Xresolution and EXIF:Yresolution tags. Windows does not read the Xresolution/Yresolution tags that appear in the JFIF block.
"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

GeoVan

Thank you very much.
So, please what is the exiftool command in order to overcome this problem, and instead of get value 1 to get the correct value 96 ?

StarGeek

exiftool -EXIF:Xresolution=1 -EXIF:Yresolution=1 /path/to/files/

This command creates backup files.  Add -Overwrite_Original to suppress the creation of backup files.  Add -r to recurse into subdirectories.
"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

GeoVan

Thank you very much.
I try the command:
exiftool -EXIF:Xresolution=1 -EXIF:Yresolution=1 -Overwrite_Original  input.jpg

but unfortunately, again it gives  image RESOLUTION value 1 (both for Xresolution and Yresolution)  instead of the correct value 96.

What am i doing wrong, please?

StarGeek

Sorry, misread what you wanted.  Change the 1 to 96, or any other resolution you might want.

Understand, though, 96 isn't the "correct" value, it's Windows default value.  Other programs will have different default values, and I believe 72 is the most common default value. Adobe programs, for example, will use 72 as the default value.
"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

GeoVan

I appreciate your help.
But please note that i do not want to change the Xresolution and Yresolution.
I am trying to "get" their value, because i use it in a formula.
So, the Windows Explorer value is significant for me.
The following Exiftool command works for some of jpg files:
exiftool.exe -XResolution -YResolution input.jpg    --> (provided that the jpg file is named as "input.jpg")

But unfortunately for some other jpg files gives the value of 1 instead of the "correct Windows explorer" value.

So, is there any way using the EXIFTOOL, to get the Xresolution and Yresolution "correct Windows explorer" SAME values, please?

StarGeek

No, because they do not exist.  They are simply default values that Windows assigns when it can't find any of the tags it actually reads in the file.

The only thing you can do is run
exiftool -EXIF:Xresolution -EXIF:Yresolution /path/to/files/

And if exiftool doesn't return any output from that, then assign the default values yourself to your formula.
"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