Page 1 of 1

Imagemagick ignores pixel resolution in TIFF-images

Posted: 2006-09-02T04:54:11-07:00
by donovaly
Have a look at this TIFF-image:

http://fkurth.de/uwest/usti/TESTB.TIF

It is a SEM image that shows a round hole and has 512x512 pixels.
But the pixel resolution in x- and y-direction is different:

x-direction: 84.211 dpi
y-direction: 107.789 dpi
(ratio of y/x is exactly 1.28 )

The resolutions are stored in the TIFF header and are conform to the TIFF definition. But Imagemagick doesn't take about this and displays and converts the image as if both directions would have the same resolution. The result is a squeezed image, convert it for example to PNG and you'll see that the shown round hole becomes oval.

When Imagemagick converts TIFF-images it should take care of the resolutions and if the target image format cannot handle different resolutions it should automatically recalculate the image, in this case to 512x655 pixels.

The built in image viewer of WinXP for example does this job correctly.

Posted: 2006-09-02T08:15:01-07:00
by magick
The ImageMagick philosophy is to not do anything automatically. It instead does what the user tells it to do. PNG saves the image resolution so no changes to the image pixels are expected for PNG. For other image formats you can request a square aspect ratio with the -resample option:
  • convert TESTB.TIF -resample 107.789x107.789 image.pnm
The same reasoning applies to the image display program. The display program permits the user to edit image pixels and the user may not want to edit resampled pixels. We did notice the -resample option appears to be missing from the display program so we will fix that in the next release.

Posted: 2006-09-02T08:43:38-07:00
by donovaly
magick wrote: We did notice the -resample option appears to be missing from the display program so we will fix that in the next release.


Thanks in advance for this and for your quick reply.