ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: GeoVan on March 04, 2024, 10:56:36 AM

Title: Exiftool fail to get xresolution and yresolution from jpg
Post by: GeoVan on March 04, 2024, 10:56:36 AM
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?
Title: Re: Exiftool fail to get xresolution and yresolution from jpg
Post by: StarGeek on March 04, 2024, 11:42:26 AM
See the Windows Metadata thread (https://exiftool.org/forum/index.php?topic=6591.0).

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.
Title: Re: Exiftool fail to get xresolution and yresolution from jpg
Post by: GeoVan on March 04, 2024, 12:57:35 PM
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 ?
Title: Re: Exiftool fail to get xresolution and yresolution from jpg
Post by: StarGeek on March 04, 2024, 01:02:00 PM
exiftool -EXIF:Xresolution=1 -EXIF:Yresolution=1 /path/to/files/

This command creates backup files.  Add -Overwrite_Original (https://exiftool.org/exiftool_pod.html#overwrite_original) to suppress the creation of backup files.  Add -r (https://exiftool.org/exiftool_pod.html#r-.--recurse) to recurse into subdirectories.
Title: Re: Exiftool fail to get xresolution and yresolution from jpg
Post by: GeoVan on March 04, 2024, 01:18:02 PM
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?
Title: Re: Exiftool fail to get xresolution and yresolution from jpg
Post by: StarGeek on March 04, 2024, 03:34:05 PM
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.
Title: Re: Exiftool fail to get xresolution and yresolution from jpg
Post by: GeoVan on March 04, 2024, 04:10:19 PM
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?
Title: Re: Exiftool fail to get xresolution and yresolution from jpg
Post by: StarGeek on March 04, 2024, 04:52:57 PM
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.
Title: Re: Exiftool fail to get xresolution and yresolution from jpg
Post by: GeoVan on March 05, 2024, 10:35:22 AM
Thank you very much!