I use ImageMagick as an external program to convert multi-page fax to visible PNG:
/usr/bin/convert /var/voip/fax/out/2012/04/fax_out_L1_17.tiff[0] -scale 50x100% -depth 16 /tmp/fax_images/fax_out_L1_17-0-m.png
converts the first page to PNG
aaa.tiff [1] will be the second page, etc.
Or, to extract all images, follow these steps:
convert -verbose fax_in_L1-1333564876.469.tiff a.png fax_in_L1-1333564876.469.tiff[0] TIFF 1728x1078 1728x1078+0+0 1-bit Bilevel DirectClass 109KiB 0.030u 0:00.030 fax_in_L1-1333564876.469.tiff[1] TIFF 1728x1078 1728x1078+0+0 1-bit Bilevel DirectClass 109KiB 0.020u 0:00.010 fax_in_L1-1333564876.469.tiff[2] TIFF 1728x1078 1728x1078+0+0 1-bit Bilevel DirectClass 109KiB 0.020u 0:00.010 fax_in_L1-1333564876.469.tiff=>a-0.png[0] TIFF 1728x1078 1728x1078+0+0 1-bit Bilevel DirectClass 12KiB 0.030u 0:00.019 fax_in_L1-1333564876.469.tiff=>a-1.png[1] TIFF 1728x1078 1728x1078+0+0 1-bit Bilevel DirectClass 8KiB 0.040u 0:00.039 fax_in_L1-1333564876.469.tiff=>a-2.png[2] TIFF 1728x1078 1728x1078+0+0 1-bit Bilevel DirectClass 32KiB 0.070u 0:00.070
So, just to split one multi-page TIFF into multi-page TIFF, you have to do:
convert in-12345.tiff /tmp/out-12345.tiff
and then work with temporary files: / tmp / out-12345 - *. tiff
However, ImageMagick can do a lot of processing, so you can probably achieve the desired result in one command.
source share