Page 1 of 1

determining the pixel aspect ratio of a TIFF

Posted: 2018-06-19T12:00:58-07:00
by easyhtrees
Hi there, this is a little out of my domain so please bear with me. I have a TIFF image coming out of an in house application and the issue seems to be that, while the size of the image is correct (1024 x 768), the pixel aspect ratio is not. How do I measure this using ImageMagick for Windows? I had heard this tool could do it, but I am not sure how. Thanks in advance.

Re: determining the pixel aspect ration of a TIFF

Posted: 2018-06-19T12:07:25-07:00
by fmw42
What do you mean by pixel aspect ratio? Do you mean the width/height ratio of the image where the width and height are in pixels? If so, then

Code: Select all

convert image.tiff -format "%[fx:w/h]\n" info:
If on IM 7, then use magick rather than convert.

____________________________

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown

Re: determining the pixel aspect ration of a TIFF

Posted: 2018-06-19T12:23:39-07:00
by easyhtrees
Thanks for the response. My understanding is that 'Pixel Aspect Ratio' refers to the ratio of the pixel's width to its height. I should clarify that the above doesn't give me that information.

Re: determining the pixel aspect ratio of a TIFF

Posted: 2018-06-19T13:07:53-07:00
by snibgo
easyhtrees wrote:How do I measure this using ImageMagick for Windows?
Please link to a sample TIFF with non-unity pixel aspect ratio. Then we can try a few things.

Re: determining the pixel aspect ratio of a TIFF

Posted: 2018-06-19T14:23:22-07:00
by easyhtrees
Here is an upload: https://imgur.com/hPq53nZ

Re: determining the pixel aspect ratio of a TIFF

Posted: 2018-06-19T14:32:44-07:00
by snibgo
You asked about TIFF, but the link is to a PNG?

"hPq53nZ - Imgur.png" seems to have square pixels.

But I've remembered how pixel aspect ratio is recorded: in the density. Square pixels (the normal situation) have equal densities in x and y. Non-square have unequal densities.

Re: determining the pixel aspect ratio of a TIFF

Posted: 2018-06-19T15:11:45-07:00
by easyhtrees
Is there a better image hosting site I can use? It's TIFF on disk, I don't know how it ended up being a PNG.

Re: determining the pixel aspect ratio of a TIFF

Posted: 2018-06-19T15:24:22-07:00
by snibgo
Don't use an image hosting website. They often convert the image to something else for display. Some allow the original to be downloaded, but some discard the original.

Instead, use a file hosting site. dropbox.com seems to work fine.

But you can do the test yourself:

Code: Select all

magick identify -verbose yourfile.tiff
Look for a line like "Resolution: 200x100"

Re: determining the pixel aspect ratio of a TIFF

Posted: 2018-06-19T15:33:54-07:00
by easyhtrees
I just tried that and sure enough, the AR is not 1. Thanks, I'll use this method for now.

Re: determining the pixel aspect ratio of a TIFF

Posted: 2018-06-19T15:50:49-07:00
by GeeMack
easyhtrees wrote: 2018-06-19T15:33:54-07:00I just tried that and sure enough, the AR is not 1. Thanks, I'll use this method for now.
This should give you both X and Y resolutions...

Code: Select all

magick input.tif -format "%[fx:resolution.x] %[fx:resolution.y]" info:
You can use those FX expressions in a calculation to get the aspect...

Code: Select all

magick input.tif -format "%[fx:resolution.x/resolution.y]" info:
If you're using IM6 use "convert" instead of "magick".