2010.04.30 12:55 "Re: [Tiff] Problem with tiff2ps page split", by Thomas Jarosch
On Thursday, 29. April 2010 21:38:24 Richard Nolde wrote:
On 04/29/2010 11:00 AM, email@example.com wrote: > tiffcrop -e combined -U in -X 8.26 very_long_page.tiff cropped.tiff Several suggestions:
The export flag, -e, is used to define how multiple selections for a single image are presented in the output image file. Using -e combined would take multiple selections from a given image and combine them into a single image in the output file. What you want is -e divided so create separate images for each selection but write them all to one output file.
The -X flag is used to select a single section of an image of a given width. Without any other specifier, the entire length of the image will be used. I suspect you want something link -Y 11.694, assuming Unit of inches as you have specified above.
Thanks for your insightful suggestions!
The idea was to use tiffcrop -X as preprocessor to tiff2ps. I wanted to make sure none of the TIFF images exceed the width of an A4 page, though the page should retain the full length/height.
Currently I prefer to use tiff2ps to split the page on the horizontal axis as it can output a bit of overlap on the next page (if splitting is done).
The width is limited to the A4 page size to make sure tiff2ps doesn't output the right margin of the previous page as an extra "blank" page.
Unfortunately, your fax doesn't match any standard paper size that I know about. The width, which must be calculated at the horizontal resolution is 8.52 inches and the height is 11.21 inches.
The length of a fax page is dynamic depending on the source material. This is a heritage from the time of continuous paper in fax machines.
Very old fax machines tend to send multiple pages as one large page instead of splitting the page at a useful boundary.
tiffcrop -P a4 -e divided produces multiple pages, two of which are very narrow, one very short, one very short and narrow in addition to the desired main pages.
Well, basically I wanted to make sure the width is max 8.27in (A4) and then split the pages at the 11.69in boundary + a bit of overlap.
It might not take but a few lines of code to add an option for a custom page size to specified on the command line, eg tiffcrop -U in -P8.52x11.21 which would break the long image into a series of images not wider or longer than those dimenions regardless of how many pages that is. Let me know if that would be useful.
Thanks for the patch you sent to me directly.
Your image is a fax in Group3 format and the horizontal and vertical resolutions do not match. This may or may not have an impact on the tiff2ps command.
TIFF Directory at offset 0x2affa (176122)
Subfile Type: multi-page document (2 = 0x2)
Image Width: 1728 Image Length: 4396
Resolution: 203, 196 pixels/inch
Compression Scheme: CCITT Group 3
As far as I can tell after looking at the code, there's no special fax size handling in there. My picture viewer (gwenview) shows the TIFF image as a really weird streched image. KDE's document viewer (okular) shows it correctly. So it's possible to compute the correct scaling.
I created the "very_long_page.tiff" image by glueing two A4 pages together.
Guess I'll create a new, simple TIFF image via GIMP with the size of two A4 pages. Then I'll try split it via tiff2ps to verify the split code works correctly. If it does, I'll retry it with the same size and resolutions like the incoming fax TIFFs do. This should help to isolate the issue... hopefully :)