non square pixel aspect ratio in tiff files
Posted: 2009-10-10T22:47:27-07:00
Hi !
When trying to create thumbnails of some FAX generated tiff files, I stumbled on a strange behaviour ...
Using MagickWand API, what I do is :
Init wand
MagickReadFile('myfax.tif')
strip all profiles
resize
MagickImageWriteFile('thumb.png')
the result is a png file which image is distorted the same way as the original tiff pixel aspect ratio (this is the same distortion that happens if you open the tiff file in photoshop and manually disable the pixel aspect ratio correction and force display as square pixels.
however if the last step is
MagickGetImageBlob and then use external code to perform a binary write to file of the blob contents, the resulting png file is properly sized and the image is not distorted.
so the question is, what calls / options / properties do I have to make / set in order to be able to use the MagickImageWriteFile and get a non distorted image ?
FYI, using "convert myfax.tif -resize 200x200 thumb.png" via commandline also exhibits the same distorted result. if I force the resize geometry with !, i get the distorted result distorted a second time to fit the 200x200 size ...
Here is a link to get a small sample TIFF file to reproduce the issue :
http://uploadfile.org/download.php?id=1 ... Njil8upl3W
I also noticed that when thumbnailing PDF files, MagickImageWriteFile writes a good PNG file, while executing exactly the same code as above (the one leading to non distorted tiffs with MagickGetImageBlob) produces broken PNG files... Any thoughts on why this could happen please ?
Sample 'broken' png file for this case : http://uploadfile.org/download.php?id=R ... czJNohFAIL
Thanks !
When trying to create thumbnails of some FAX generated tiff files, I stumbled on a strange behaviour ...
Using MagickWand API, what I do is :
Init wand
MagickReadFile('myfax.tif')
strip all profiles
resize
MagickImageWriteFile('thumb.png')
the result is a png file which image is distorted the same way as the original tiff pixel aspect ratio (this is the same distortion that happens if you open the tiff file in photoshop and manually disable the pixel aspect ratio correction and force display as square pixels.
however if the last step is
MagickGetImageBlob and then use external code to perform a binary write to file of the blob contents, the resulting png file is properly sized and the image is not distorted.
so the question is, what calls / options / properties do I have to make / set in order to be able to use the MagickImageWriteFile and get a non distorted image ?
FYI, using "convert myfax.tif -resize 200x200 thumb.png" via commandline also exhibits the same distorted result. if I force the resize geometry with !, i get the distorted result distorted a second time to fit the 200x200 size ...
Here is a link to get a small sample TIFF file to reproduce the issue :
http://uploadfile.org/download.php?id=1 ... Njil8upl3W
I also noticed that when thumbnailing PDF files, MagickImageWriteFile writes a good PNG file, while executing exactly the same code as above (the one leading to non distorted tiffs with MagickGetImageBlob) produces broken PNG files... Any thoughts on why this could happen please ?
Sample 'broken' png file for this case : http://uploadfile.org/download.php?id=R ... czJNohFAIL
Thanks !