ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: Luca on October 23, 2017, 04:58:06 AM

Title: Read Wrong Resolution
Post by: Luca on October 23, 2017, 04:58:06 AM
Hi,

I use exitfool to read image information for my site. It works fine for most images but sometimes it gives me a wrong resolution. XResolution and YResolution are set to 1.
The OP is linux and the exiftool version is 10.64
Output from command line: exiftool -G1 -s -a <file>

[ExifTool]      ExifToolVersion                 : 10.64
[System]        FileName                        : image1.jpg
[System]        Directory                       : ../../Desktop
[System]        FileSize                        : 3.5 MB
[System]        FileModifyDate                  : 2017:10:20 11:24:24+02:00
[System]        FileAccessDate                  : 2017:10:23 09:06:21+02:00
[System]        FileInodeChangeDate             : 2017:10:20 11:24:24+02:00
[System]        FilePermissions                 : rwxrw-rw-
[File]          FileType                        : JPEG
[File]          FileTypeExtension               : jpg
[File]          MIMEType                        : image/jpeg
[File]          ExifByteOrder                   : Big-endian (Motorola, MM)
[File]          Comment                         : CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 100.
[File]          ImageWidth                      : 2560
[File]          ImageHeight                     : 1600
[File]          EncodingProcess                 : Baseline DCT, Huffman coding
[File]          BitsPerSample                   : 8
[File]          ColorComponents                 : 3
[File]          YCbCrSubSampling                : YCbCr4:2:0 (2 2)
[JFIF]          JFIFVersion                     : 1.01
[JFIF]          ResolutionUnit                  : None
[JFIF]          XResolution                     : 1
[JFIF]          YResolution                     : 1
[IFD0]          XResolution                     : 1
[IFD0]          YResolution                     : 1
[IFD0]          ResolutionUnit                  : None
[IFD0]          YCbCrPositioning                : Centered
[Composite]     ImageSize                       : 2560x1600
[Composite]     Megapixels                      : 4.1

If i open the image with a program like gimp or photoshop i can retrive these information as 96dpi.
There is any way to retrive these correct information with exiftool?.

An example image can be found here: http://farnet.thepot.site/example/image1.jpg
Title: Re: Read Wrong Resolution
Post by: Phil Harvey on October 23, 2017, 07:22:27 AM
ExifTool is of course correct.  I don't know why the other software reports otherwise.

I opened this in Photoshop but can't find where it tells me the resolution.  The image you posted contains JFIF resolutions but not EXIF resolutions, so it is different from the metadata you posted.

- Phil
Title: Re: Read Wrong Resolution
Post by: Hayo Baan on October 23, 2017, 03:59:48 PM
Interesting, Photoshop, Preview, and PhotoMechanic all tell me the resolution is 72ppi.
I'm thinking they don't look at the JFIF resolution at all (or assume 1 is incorrect) and revert to a default (72ppi)
Title: Re: Read Wrong Resolution
Post by: StarGeek on October 23, 2017, 06:44:40 PM
What are the results in those programs when you add Photoshop:XResolution and Photoshop:YResolution?
Title: Re: Read Wrong Resolution
Post by: Jaap on February 01, 2018, 06:10:14 AM
I've found a similar issue with the attached file. The JFIF XResolution and YResolution report '1', while Photoshop reports 72dpi. You can check this in Photoshop via Image -> Image Size (see screenshot attached).

Output for exiftool -G1 -s -a

[ExifTool]      ExifToolVersion                 : 10.55
[System]        FileName                        : test-incorrect-reso.jpg
[System]        FileSize                        : 1178 kB
[System]        FileModifyDate                  : 2018:02:01 11:56:09+01:00
[System]        FileAccessDate                  : 2018:02:01 11:56:11+01:00
[System]        FileInodeChangeDate             : 2018:02:01 11:56:09+01:00
[System]        FilePermissions                 : rw-r--r--
[File]          FileType                        : JPEG
[File]          FileTypeExtension               : jpg
[File]          MIMEType                        : image/jpeg
[File]          ExifByteOrder                   : Big-endian (Motorola, MM)
[File]          ImageWidth                      : 2365
[File]          ImageHeight                     : 1774
[File]          EncodingProcess                 : Progressive DCT, Huffman coding
[File]          BitsPerSample                   : 8
[File]          ColorComponents                 : 3
[File]          YCbCrSubSampling                : YCbCr4:2:0 (2 2)
[JFIF]          JFIFVersion                     : 1.01
[JFIF]          ResolutionUnit                  : None
[JFIF]          XResolution                     : 1
[JFIF]          YResolution                     : 1
[ICC-header]    ProfileCMMType                  : Lino
[ICC-header]    ProfileVersion                  : 2.1.0
[ICC-header]    ProfileClass                    : Display Device Profile
[ICC-header]    ColorSpaceData                  : RGB
[ICC-header]    ProfileConnectionSpace          : XYZ
[ICC-header]    ProfileDateTime                 : 1998:02:09 06:49:00
[ICC-header]    ProfileFileSignature            : acsp
[ICC-header]    PrimaryPlatform                 : Microsoft Corporation
[ICC-header]    CMMFlags                        : Not Embedded, Independent
[ICC-header]    DeviceManufacturer              : IEC
[ICC-header]    DeviceModel                     : sRGB
[ICC-header]    DeviceAttributes                : Reflective, Glossy, Positive, Color
[ICC-header]    RenderingIntent                 : Perceptual
[ICC-header]    ConnectionSpaceIlluminant       : 0.9642 1 0.82491
[ICC-header]    ProfileCreator                  : HP
[ICC-header]    ProfileID                       : 0
[ICC_Profile]   ProfileCopyright                : Copyright (c) 1998 Hewlett-Packard Company
[ICC_Profile]   ProfileDescription              : sRGB IEC61966-2.1
[ICC_Profile]   MediaWhitePoint                 : 0.95045 1 1.08905
[ICC_Profile]   MediaBlackPoint                 : 0 0 0
[ICC_Profile]   RedMatrixColumn                 : 0.43607 0.22249 0.01392
[ICC_Profile]   GreenMatrixColumn               : 0.38515 0.71687 0.09708
[ICC_Profile]   BlueMatrixColumn                : 0.14307 0.06061 0.7141
[ICC_Profile]   DeviceMfgDesc                   : IEC http://www.iec.ch
[ICC_Profile]   DeviceModelDesc                 : IEC 61966-2.1 Default RGB colour space - sRGB
[ICC_Profile]   ViewingCondDesc                 : Reference Viewing Condition in IEC61966-2.1
[ICC_Profile]   Luminance                       : 76.03647 80 87.12462
[ICC_Profile]   Technology                      : Cathode Ray Tube Display
[ICC_Profile]   RedTRC                          : (Binary data 2060 bytes, use -b option to extract)
[ICC_Profile]   GreenTRC                        : (Binary data 2060 bytes, use -b option to extract)
[ICC_Profile]   BlueTRC                         : (Binary data 2060 bytes, use -b option to extract)
[ICC-view]      ViewingCondIlluminant           : 19.6445 20.3718 16.8089
[ICC-view]      ViewingCondSurround             : 3.92889 4.07439 3.36179
[ICC-view]      ViewingCondIlluminantType       : D50
[ICC-meas]      MeasurementObserver             : CIE 1931
[ICC-meas]      MeasurementBacking              : 0 0 0
[ICC-meas]      MeasurementGeometry             : Unknown
[ICC-meas]      MeasurementFlare                : 0.999%
[ICC-meas]      MeasurementIlluminant           : D65
[ExifIFD]       ColorSpace                      : sRGB
[ExifIFD]       ExifImageWidth                  : 2365
[ExifIFD]       ExifImageHeight                 : 1774
[XMP-x]         XMPToolkit                      : Image::ExifTool 8.95
[XMP-xmpMM]     DocumentID                      : xmp.did:445defc3-7160-4d12-a28d-1e1a2be86649
[XMP-xmpMM]     InstanceID                      : xmp.iid:445defc3-7160-4d12-a28d-1e1a2be86649
[XMP-xmpMM]     OriginalDocumentID              : xmp.did:445defc3-7160-4d12-a28d-1e1a2be86649
[Composite]     ImageSize                       : 2365x1774
[Composite]     Megapixels                      : 4.2
Title: Re: Read Wrong Resolution
Post by: Phil Harvey on February 01, 2018, 07:08:16 AM
I don't think this is an ExifTool issue.  ExifTool is reporting the resolution stored in the file.  My guess is that Photoshop has set some limits on reasonable resolutions and defaults to 72 dpi if the stored resolutions are outside these limits.

- Phil
Title: Re: Read Wrong Resolution
Post by: Jaap on February 01, 2018, 07:47:12 AM
Thanks for your quick reply. I guess there are tools out there that write incorrect resolution info into the file metadata. Your assumption on the Photoshop behavior makes sense.

Thanks for your feedback,
Jaap
Title: Re: Read Wrong Resolution
Post by: Phil Harvey on February 01, 2018, 07:51:49 AM
Under the category of "learn something new every day", from the JFIF specification:

"if you only want to specify a pixel aspect ratio, put 0 for the units field in the special APP0 field. Xdensity and Ydensity can then be programmed for the desired aspect ratio. Xdensity = 1, Ydensity = 1 will program a 1:1 aspect ratio. Xdensity and Ydensity should always be non-zero."

So this is not an error.

I guess this makes some sense, because the units are set to "None":

> exiftool ~/Desktop/test-incorrect-reso.jpg -jfif:all
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1


- Phil
Title: Re: Read Wrong Resolution
Post by: Jaap on February 01, 2018, 08:22:23 AM
Ahaaa, right... Speaking about confusing standards ;)

Anyway this makes sense now. I will probably ignore the JFIF X and Y Resolution values when the Resolution Unit is set to None (and default to 72ppi like PS is doing).

The actual data in these fields is still incorrect though as it's not a square image (Not an ExifTool problem).

Thanks again Phil :)