Pixel Dimension tags

Started by eponymous, July 04, 2022, 01:25:54 PM

Previous topic - Next topic

eponymous

Just starting using a new photo scanner (Epson V600) and when I use Imagemagick to grab the info, it reports this error (using grep to get just the relevant line which describe the image width):


> identify -verbose Pictures/image.tif | grep -i 5584
  Geometry: 3998x5584+0+0
  Page geometry: 3998x5584+0+0
identify: Incorrect value for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/960.
identify: Wrong data type 3 for "PixelXDimension"; tag ignored. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/960.
identify: Wrong data type 3 for "PixelYDimension"; tag ignored. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/960.


When I look up the Pixel Dimension tags, I find that they're perhaps needed only for compressed images (which this isn't; see below).

However, I find that exiftool seems to call this same tag by another name:


> exiftool -s Pictures/image.tif | grep -i 5584
ImageHeight                     : 5584
ExifImageHeight                 : 5584
ImageSize                       : 3998x5584


I find this post from a few years ago:
Quote from: Phil Harvey on November 01, 2015, 04:05:29 PM
There is no ExifTool tag called PixelXDimension.  ExifTool calls it ExifImageWidth, because it is the image width, duplicated in the EXIF information.

But that tag is described is several places in the exif spec. (If I understand it correctly, it's to make clear the dimensions of images in compression schemes (like jpeg) where the image edge falls somewhere not on an iMCU boundary.)

So two questions:


  • Are PixelXDimension and ExifImageWidth actually the same tags?
  • Is it correct that these tags shouldn't be present in uncompressed files?

TIA.

StarGeek

Quote from: eponymous on July 04, 2022, 01:25:54 PMAre PixelXDimension and ExifImageWidth actually the same tags?

Yes.  If you look up the entries for ExifImageWidth/ExifImageHeight on the EXIF tags page, you'll see that it is mentioned in the Notes column.

QuoteIs it correct that these tags shouldn't be present in uncompressed files?

I would say that they are required by the EXIF specs because when you run exiftool on a file and include the -Validate option, you'll see this response
C:\>exiftool -g1 -a -s -warning -validate y:\!temp\Test4.jpg
---- ExifTool ----
Warning                         : Missing required JPEG ExifIFD tag 0xa002 ExifImageWidth
Warning                         : Missing required JPEG ExifIFD tag 0xa003 ExifImageHeight
Validate                        : 2 Warnings
* 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).

eponymous

Thanks for the help!

Quote from: StarGeek on July 05, 2022, 11:17:44 AM
QuoteIs it correct that these tags shouldn't be present in uncompressed files?

I would say that they are required by the EXIF specs because when you run exiftool on a file and include the -Validate option, you'll see this response
C:\>exiftool -g1 -a -s -warning -validate y:\!temp\Test4.jpg
---- ExifTool ----
Warning                         : Missing required JPEG ExifIFD tag 0xa002 ExifImageWidth
Warning                         : Missing required JPEG ExifIFD tag 0xa003 ExifImageHeight
Validate                        : 2 Warnings


Right, but this is a jpeg file which has the issue with image borders not lining up with an iMCU boundary, which is maybe a better way to describe where it's needed though perhaps the fact that jpegs are almost always compressed makes it as good as required. In any case the file coming from my scan software is a tiff.

StarGeek

Quote from: eponymous on July 05, 2022, 02:39:53 PM
Right, but this is a jpeg file which has the issue with image borders not lining up with an iMCU boundary, which is maybe a better way to describe where it's needed though perhaps the fact that jpegs are almost always compressed makes it as good as required.

While it's required by the EXIF standard, it's pretty much universally ignored.  The actual image dimensions are taken from the Jpeg SOF segment.  For example, if you use the -v3 (-verbose3) option on a jpg, you'll get the hex dump of each section.  In this example, bytes 0x04b5 is the 1205 heigh and 06db is the 1749 width.
JPEG SOF0 (15 bytes):
    0dbe: 08 04 b5 06 d5 03 01 22 00 02 11 01 03 11 01    [.......".......]
  ImageWidth = 1749
  ImageHeight = 1205
  EncodingProcess = 0
  BitsPerSample = 8
  ColorComponents = 3
  YCbCrSubSampling = 2 2


And that doesn't even take into account the fact that the EXIF data is completely optional in a jpeg file.

But going back to original question 2, a quick test showed me that it probably is needed in some form in a TIFF file, compressed or not.  I had exiftool forcibly remove ImageHeight and ImageWidth from a uncompressed tiff and the file was no longer renderable, at least by Irfanview.
* 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

Quote from: eponymous on July 04, 2022, 01:25:54 PM

  • Are PixelXDimension and ExifImageWidth actually the same tags?
  • Is it correct that these tags shouldn't be present in uncompressed files?


  • Yes.
  • Yes.

- 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 ($).