Multipage TIFF manipulation
Posted: 2011-05-31T04:24:42-07:00
Hi Everybody
I'm trying to use the MSL method to automate some image manipulation. The reason for choosing MSL is the ability to script and easy customization. The example mentioned below is only the start, I will extend it further and need some characteristics of the tiff file read so I can produce the correct result.
My problem is the manipulation of multipage tiff files. In the verbose output I can see that both pages are read, but only one is written to the result file. Here is an example script, reading the file, removing the header and writing it back to disk:
If called with verbose output enabled and an example file with two pages, I get the following:
As you can see, it reads both pages, but only writes one page back to the output file.
Just for information, the final goal is to remove the existing header on all pages, put a new one at the top of every page and then write the file back to disk. The removal works if called from the command line, processing each page and writing it back as well, but not from the script.
Any Ideas? Is this possible with MSL or is this feature missing?
Best regards
Oliver
I'm trying to use the MSL method to automate some image manipulation. The reason for choosing MSL is the ability to script and easy customization. The example mentioned below is only the start, I will extend it further and need some characteristics of the tiff file read so I can produce the correct result.
My problem is the manipulation of multipage tiff files. In the verbose output I can see that both pages are read, but only one is written to the result file. Here is an example script, reading the file, removing the header and writing it back to disk:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<image>
<read filename="Fax.tif" />
<get width="base-width" height="base-height" />
<chop geometry="0x50" />
<get width="width" height="height" />
<print output="Image sized from %[base-width]x%[base-height] to %[width]x%[height].\n" />
<write filename="Fax-out.tif" />
</image>
Code: Select all
Fax.tif[0] TIFF 1728x2394 1728x2394+0+0 1-bit Bilevel DirectClass 110KB 0.047u 0:00.046
Fax.tif[1] TIFF 1728x2394 1728x2394+0+0 1-bit Bilevel DirectClass 110KB 0.031u 0:00.031
Image sized from 1728x2394 to 1728x2344.
Fax.tif=>Fax-out.tif TIFF 1728x2394=>1728x2344 1728x2344+0+0 1-bit Bilevel DirectClass 54.5KB 0.063u 0:00.062
msl:CutHeader.msl=>CutHeader.msl MSL 1x1 1x1+0+0 16-bit DirectClass 344B 0.125u 0:00.125
Just for information, the final goal is to remove the existing header on all pages, put a new one at the top of every page and then write the file back to disk. The removal works if called from the command line, processing each page and writing it back as well, but not from the script.
Code: Select all
convert Fax.tif -chop 0x50 Fax-chop.tif
Best regards
Oliver