Page 1 of 1

fax tiff to jpg, dealing with multiple resolutions

Posted: 2013-04-22T06:38:24-07:00
by mmlenz
I'm using:

convert -quiet source.tif -resize 400x400 low-%d.jpg

(with the above I'm using -resize 400x400 to limit the max width/height of the resulting image)

To convert the following:

source-A.tif
Geometry: 1728x2135+0+0
Resolution: 204x196

source-B.tif
Geometry: 1728x1097+0+0
Resolution: 204x98

source-A.tif generates low resolution preview jpgs that look correct, but souce-B.tif produces previews that are squashed vertically. I can use -resize 100x200%! to help with the problem with source-B.tif but then source-A.tif is now vertically stretched.

Is there a single convert command line that can "just work" for both?

Thanks guys.

Re: fax tiff to jpg, dealing with multiple resolutions

Posted: 2013-04-22T10:03:44-07:00
by fmw42
-resize 400x400 should produce images that preserve the aspect ratio and not distort the image. The result will resize the larger of your image dimensions to 400 and the other will scaled according to the aspect ratio.

I suspect you have a bug or problem with one of your input images. Does either of your images have a virtual canvas that is larger than your image size? Try adding +repage right after reading the input and before the -resize.

What version of IM and platform are you using?

Can you post a link to you input images? Post them on a free image hosting service and put a link here.

Re: fax tiff to jpg, dealing with multiple resolutions

Posted: 2013-04-22T10:06:57-07:00
by mmlenz
fmw42 wrote:-resize 400x400 should produce images that preserve the aspect ratio and not distort the image. The result will resize the larger of your image dimensions to 400 and the other will scaled according to the aspect ratio.

I suspect you have a bug or problem with one of your input images. Does either of your images have a virtual canvas that is larger than your image size? Try adding +repage right after reading the input and before the -resize.

What version of IM and platform are you using?

Can you post a link to you input images? Post them on a free image hosting service and put a link here.
Fax tiffs are strange sometimes. You'll get some that are around 200x200 resolution and others that are around 200x100. You have to correct for those by doubling the height. I'm just trying to figure out a way to have it work for those as well as images with similar width/height resolutions all in one convert command. Otherwise I'm going to have to do an identify and parse out the resolution and if it's wonkey , prepend the -resize 100x200%!

$ identify -version
Version: ImageMagick 6.6.0-4 2012-05-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP

It's running on Debian Squeeze 6.x

Re: fax tiff to jpg, dealing with multiple resolutions

Posted: 2013-04-22T11:04:09-07:00
by fmw42
See -resample, it takes the density (dpi) into account.

http://www.imagemagick.org/script/comma ... p#resample

Re: fax tiff to jpg, dealing with multiple resolutions

Posted: 2013-04-22T12:08:57-07:00
by mmlenz
WORKS! Thanks so much! Since these are just thumbnails and image previews I will use -resample 200