2008.01.21 19:38 "[Tiff] How to clip an image with LibTiff", by

2008.01.22 20:39 "Re: [Tiff] How to clip an image with LibTiff", by Andrey Kiselev

On Mon, Jan 21, 2008 at 01:38:09PM -0600, Erez.Har-Tal@Walgreens.com wrote:

We deal with faxes in standard mode (204X98 dpi) or fine mode (204X198 dpi) saved with compression of type G3 1D.

I need to write a utility that clips the first X rows (pixel) from the top of the tiff image and last X rows from the bottom of the tiff image. We will save it to a new tiff image with G3 compression in the height of 2X pixels. The first X rows will be the top of the new image and the last X rows will be the bottom of the image. The operation to clip the image, should not alter the image nor do any thing that would damage the image.

Is it doable using libtiff on Unix? Any help and direction will be highly appreciated. Doable using other open source libraries?

That is pretty doable with libtiff. Moreover, there is a ready to use utility called tiffcrop capable to perform various geometry transformations. But it can't do stretching though. What kind of input image do you have? Is it a raw fax or TIFF? If it is a raw file you can use fax2tiff utility to do stretching and conversion to TIFF and tiffcrop on resulting file.

Both fax2tiff and tiffcrop are part of libtiff distribution.

 http://remotesensing.org/libtiff/man/fax2tiff.1.html
 http://remotesensing.org/libtiff/man/tiffcrop.1.html

Best regards,

Andrey

--
Andrey V. Kiselev
ICQ# 26871517