Imagemagick ignores pixel resolution in TIFF-images

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Locked
donovaly
Posts: 43
Joined: 2004-10-04T16:24:55-07:00

Imagemagick ignores pixel resolution in TIFF-images

Post 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.

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Post 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.

donovaly
Posts: 43
Joined: 2004-10-04T16:24:55-07:00

Post 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.

Locked