How to convert a multi-page PDF to single-page TIFFs
Asked Answered
L

1

6

This thread asks for how to convert multi-page PDF to multi-page TIFF with Ghostscript;

However, I want to covert a multi page PDF to a number of single-page TIFFs: Each page in the PDF is expected to be converted to a single TIFF file. So the above answer does not exactly match what I need.

How can I achieve this?

I am using Windows XP.

Lemmy answered 17/2, 2015 at 19:51 Comment(3)
possible duplicate of Tools to convert multipage PDF to multipage TIFFBina
The simple answer is to use the '%d' syntax in OutputFile. Eg -sOutputFile=out%d.tif. IMO the question isn't too broad, there's one good answer and its not too long.Affidavit
I just noticed that although this is tagged as Ghostscript, its not clear the OP knows how to use GS, though the answer already referenced does contain the basic information.Affidavit
F
6

Be sure to have a recent version of Ghostscript installed. Then you can run these commands:

gs                              \
  -o singlepage-tiffg4-%03d.tif \
  -sDEVICE=tiffg4               \
   multipage-input.pdf

and

gs                                \
  -o singlepage-tiff24nc-%03d.tif \
  -sDEVICE=tiff24nc               \
   multipage-input.pdf

and

gs                                \
  -o singlepage-tiff32nc-%03d.tif \
  -sDEVICE=tiff32nc               \
   multipage-input.pdf

The commands will generate you 3 sets of TIFF files. Each set contains singlepage TIFFs which carry names that contain an index numbers starting with 001:

ls -lt singlepage-tiff*.tif

 -rw-r--r--  1 kp  staff  161975 18 Feb 15:49 singlepage-tiffg4-001.tif
 -rw-r--r--  1 kp  staff  169294 18 Feb 15:49 singlepage-tiffg4-002.tif
 -rw-r--r--  1 kp  staff  167397 18 Feb 15:49 singlepage-tiffg4-003.tif
 -rw-r--r--  1 kp  staff  190052 18 Feb 15:49 singlepage-tiffg4-004.tif

If you have a lot of PDF pages per file, you can increase the number of digits/leading zeros to a higher number: use %05d to get a 5 digit numbering.

The three different commands generate different types of TIFF:

  1. The tiffg4 ones are grayscale TIFFs.
    They use a resolution of 204dpi by 196dpi (as the TIFF G4 fax standard requires).
  2. The tiff24nc ones are in RGB color (with 8 bits per color component).
    They use a resolution of 72dpi by 72dpi.
  3. The tiff32nc ones are in CMYK color (with 8 bits per color).
    They also use a resolution of 72dpi.

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 command lines.

Fraternity answered 18/2, 2015 at 14:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.