Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Cutting a TIFF/G3 image?



An interesting problem:

My client receives faxes electronically through a frame-relay
link from MCI.  Letter sized faxes are usually received with
attributes similar to the following:

> TIFF Directory at offset 0x10c76
>   Subfile Type: multi-page document (2 = 0x2)
>   Image Width: 1728 Image Length: 2168
>   Resolution: 204, 196 pixels/inch
>   Bits/Sample: 1
>   Compression Scheme: CCITT Group 3
>   Photometric Interpretation: min-is-white
>   FillOrder: lsb-to-msb
>   Samples/Pixel: 1
>   Rows/Strip: 2168
>   Planar Configuration: single image plane
>   Page Number: 0-1
>   Group 3 Options: EOL padding (4 = 0x4)
>   Fax Data: clean (0 = 0x0)

You'll notice that the length of the document is 2168,
which at 196 pixels/inch comes out to 11.06 inches, just
a skosh longer than an 11" sheet of paper.  If you
generate a PostScript file of this using tiff2ps, the
result is a file that paints UP the page, so you lose
the top 12 or so scan lines.  Each time I fax the TIFF
file back to myself using HylaFAX, the document creeps
successively further up the page.

I'd like to be able to 'cut' received TIFF files to exactly
11 inches (2156 scan lines), or at least cut the extra 12
scan lines (6 lines in standard resolution.)  The TIFF
distribution doesn;t seem to supply a tool to do this,
so I have resorted to using PBM.  Here's what I've tried:

	1) split the TIFF file into pages,
	2) tifftopnm each TIFF page to PBM,
	3) pnmcut each PBM file to a shorter PBM file,

	Note: pnmfile reports that PBM file is now correct size.

	4) pnmtotiff shorter PBM file back to TIFF.
	*) Problem: Resolution tag not preserved in new TIFF file.

So I try:

	Steps 1-3 above,
	4) pbmtog3 shorter PBM file to 'raw' G3 fax format,
	5) fax2tiff G3 file to TIFF.
	*) Problem: tiffinfo reports that file is back to original
	   length!  Turns out G3 format retains knowlege of original
	   size and fax2tiff pads it back out!

So I try:

	Steps 1-4 above,
	5) g3topbm the G3 file to PBM,
	6) pnmtotiff the PBM file to TIFF.
	*) Problem: same as above... TIFF file is back to original
	   length!

Any ideas out there?  I would like to avoid using tifflib directly
if at all possible.
----------------------------------------------------------------------
Dave Bloom	               "But meanwhile, I'm still thinking..."
Neversoft Corp   
dave@andromeda.rutgers.edu



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services