Tools to convert multipage PDF to multipage TIFF [closed]
Asked Answered
D

2

8

I'm writing a small application to convert several multipage PDF's to multipage TIFF files. Per the other questions and answers on this site, I've tried both ghostscript and ImageMagick however both pieces of software only covert the first page when I run them. Are there any other tools I can use to accomplish this, preferably open source ones?

Dalessio answered 5/4, 2012 at 22:51 Comment(2)
Language? Commercial or free only?Millpond
See also: ImageMagick or GhostScript: convert a multi-page TIFF to a multi-page PDFLibelee
O
24

Actually Ghostscript can convert a multi-page PDF into a multi-page TIFF. Just be sure to have a rather recent version of Ghostscript installed. Be careful when examining the resulting TIFF as your viewer may not show all the pages of the TIFF or it may not be apparent how to advance to subsequent pages in the TIFF.

Consider the following 3 commands:

gs                        \
  -o multipage-tiffg4.tif \
  -sDEVICE=tiffg4         \
   multipage-input.pdf

and

gs                          \
  -o multipage-tiff24nc.tif \
  -sDEVICE=tiff24nc         \
   multipage-input.pdf

and

gs                          \
  -o multipage-tiff32nc.tif \
  -sDEVICE=tiff32nc         \
   multipage-input.pdf

Each of these commands generates a multi-page TIFF, but with different output devices:

  1. The tiffg4 one is grayscale and uses a resolution of 204dpi by 196dpi (as the TIFF G4 fax standard requires).
  2. The tiff24nc one is in RGB color (with 8 bits per color component) and uses a resolution of 72dpi by 72dpi.
  3. The tiff32nc one is in CMYK color (with 8 bits per color) also using a resolution of 72dpi.

There are a number of additional output devices for TIFF at the link above.

All the resolution values for the TIFF files result from Ghostscript's default settings. If you want to override these, for example because you require 600dpi by 600dpi, just add

-r600x600

to any of the above commandlines.

To prove that you have multipage TIFFs, use the following command:

identify multipage-tiff*.tif

(identify is a command from the ImageMagick package, which you seem to have installed anyway.) As a result, you should see multiple lines for each of the *.tif files -- with each line representing 1 page of the respective *.tif.

I suspect it may have worked all the way for you -- that you were just unable to recognize the multiple pages in your resulting TIFFs. Not all TIFF viewers are able to display these -- they display the first page only if they can't otherwise, which may have fooled you.

Ocana answered 6/4, 2012 at 15:2 Comment(4)
Thank you for the detailed response. I discovered that the default image viewer in Ubuntu was not displaying the converted tifs correctly. I opened them in another viewer and confirmed that they were actually converted correctly using ImageMagick and Ghostscript.Dalessio
@Kurt_Pfeifle Do you know how to overt a multi-page PDF to single-page TIFFs? #28570446Hebetic
I did put this in a comment on the original question (IMO It should not have been closed). You need to specify the output file using '%d' so where Kurt has -o multipage-tiff32nc.tif you would put -o multipage-tiff32nc-%d.tifNorean
Some more helpful details about setting the resolution here: #5760938Angling
B
0

You can also use Imagick php extension if you are interested in doing it in php instead of bash script.

Berlyn answered 17/9, 2012 at 2:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.