How to call the second XResolution when there are 2 XResolutions

Started by remarkableearth, November 22, 2017, 04:08:57 PM

Previous topic - Next topic

remarkableearth

In my JPG file, there are 2 EXIF group XResolution tags at 2 different resolutions when I run exiftool -G -s -xresolution file.JPG. After reviewing the metadata values one of them is the image height and the other is the actual resolution.  At this point I don't want to throw either of them away (delete them).

How do I specify the one that is the actual resolution of the image for output? I've read the documentation for -a but I don't see how it helps me in this regard. Perhaps it does and I need it explained to me. I also checked the EXIF Tag documentation and see there is only one XResolution tag identified (as an IFD0 group).

Whether I run exiftool -G -s -xresolution file.JPG  or  exiftool -G -s -exif:xresolution file.JPG I get both tags returned without differentiation:[EXIF]          XResolution                     : 480
[EXIF]          XResolution                     : 72


Look forward to your response.

StarGeek

What is the result if you use -G1 instead of -G?  One might be in IFD0 and the other in IFD1.  If so, you could call them individually with IFD0:XResolution or IFD1:XResolution.
* 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).

remarkableearth

The result is [IFD0]          XResolution                     : 480
[IFD1]          XResolution                     : 72

Well that's more insightful.

If I'm running the command exiftool -csv -r -f -basename -xresolution /dir/subdir -ext jpg > output.csv how exactly do I modify the code to extract the IFD1 value?

Phil Harvey

Honestly, the IFD1 version isn't very useful since this is the resolution of the thumbnail image.  But this will do as you ask:

exiftool -csv -r -f -basename -ifd1:xresolution /dir/subdir -ext jpg > output.csv

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

remarkableearth

Yes, thank you. I was replying back as you wrote your response that I figured it out.

Thanks again, Phil and StarGeek!

remarkableearth

Phil,

I opened the image in question in Photoshop to check out the details of the image and see its dimensions are 640x480pxl (width x height) at a resolution of 480pxl/inch. That validates your comment that the IFD1 version provides the resolution of the thumbnail and invalidates my assumption that the correct resolution was 72. I won't be making that assumption again.

However, it does raise the question about which dimension (the width or height) fills the Xresolution and Yresolution tags. You can see for yourself in the data that the File:ImageWidth is 640 and File:ImageHeight is 480, which appear to be correct. However, the EXIF:XResolution and File:YResolution are both specified at 480, but ExifImageWidth is 640 and ExifImageHeight is 480:
[File]          FileName                        : io 001.jpg
[File]          Directory                       : .
[File]          FileSize                        : 156 kB
[File]          FileModifyDate                  : 2009:10:06 22:12:14+00:00
[File]          FileAccessDate                  : 2017:11:22 21:44:46+00:00
[File]          FileInodeChangeDate             : 2017:11:22 21:44:46+00:00
[File]          FilePermissions                 : rw-rw-r--
[File]          FileType                        : JPEG
[File]          FileTypeExtension               : jpg
[File]          MIMEType                        : image/jpeg
[File]          ExifByteOrder                   : Big-endian (Motorola, MM)
[File]          ImageWidth                      : 640
[File]          ImageHeight                     : 480
[File]          EncodingProcess                 : Baseline DCT, Huffman coding
[File]          BitsPerSample                   : 8
[File]          ColorComponents                 : 3
[File]          YCbCrSubSampling                : YCbCr4:2:0 (2 2)
[EXIF]          Make                            : EASTMAN KODAK COMPANY
[EXIF]          Model                           : KODAK Z1285 ZOOM DIGITAL CAMERA
[EXIF]          Orientation                     : Horizontal (normal)
[EXIF]          XResolution                     : 480
[EXIF]          YResolution                     : 480
[EXIF]          ResolutionUnit                  : inches
[EXIF]          YCbCrPositioning                : Centered
[EXIF]          ExifVersion                     : 0221
[EXIF]          DateTimeOriginal                : 2009:09:30 07:34:58
[EXIF]          CreateDate                      : 2009:10:03 11:37:18
[EXIF]          ComponentsConfiguration         : Y, Cb, Cr, -
[EXIF]          FlashpixVersion                 : 0100
[EXIF]          ColorSpace                      : sRGB
[EXIF]          ExifImageWidth                  : 640
[EXIF]          ExifImageHeight                 : 480
[EXIF]          InteropIndex                    : R98 - DCF basic file (sRGB)
[EXIF]          InteropVersion                  : 0100
[EXIF]          CustomRendered                  : Normal
[EXIF]          Contrast                        : Normal
[EXIF]          Saturation                      : Normal
[EXIF]          Compression                     : JPEG (old-style)
[EXIF]          Orientation                     : Horizontal (normal)
[EXIF]          XResolution                     : 72
[EXIF]          YResolution                     : 72
[EXIF]          ResolutionUnit                  : inches
[EXIF]          ThumbnailOffset                 : 2534
[EXIF]          ThumbnailLength                 : 9092
[EXIF]          ThumbnailImage                  : (Binary data 9092 bytes, use -b option to extract)


I know this has strayed from the original topic of this post but the learning never ends as I get into this stuff. Can you think of possible reasons why 1) the File:ImageWidth and EXIF:XResolution are not equal, and 2) the EXIF:XResolution and EXIF:YResolution are equal? Camera Manufacturer whim?

Thanks.

Alan Clifford

Xresolution seems to be 480 pixels per inch.  What is that used for?  How can you have inches in a digital photograph?

Try another, bigger photo as maybe the two 480's, image height and yresolution, are co-incidentally the same and not related.