Ghostscript convert PDF into large TIFF

1.9k views Asked by At

I want to resize a PDF into TIFF format with Ghostscript. We use as input PDF/X-3 which has a limitation of 5 meters in length or height.

As a result, I want to have tiff - File with correct dimensions and a final resolution of 200DPI

By scaling this to a bigger format like bigtiff (e.g):

gs -sDEVICE=tiff32nc -dNumRenderingThreads=6 -dNOPAUSE -dBATCH -dSAFER \
   -dPDFFitPage -r2000 -dUseCropBox -dUseBigTiff       \
   -sOutputFile=example.tiff test.pdf 

Edit from here: My first result is a 2000 dpi file

Just as trick to scale it to the correct pixels, I then change it to 200DPI with exiftool:

exiftool -ResolutionUnit="inch" -xResolution="200" -yResolution="200" example.tiff 

I do then have a resulting tiff with 200 DPI and dimension of 72/200 times the format I expect.

To be sure my result has the real expected format I then convert it to the calculated format:

convert example.tiff -depth 8 -resize 70866x15748\! temp-1.tiff

Would that be best suitable way to achieve the goal?

Basics steps are:

  1. Convert the image resolution to final dimension
  2. Resize it to the target dimension and the final resolution of 200 DPI

EDIT 1: The goal is to scale an image by factor with optimum results. The problem is, that customers deliver there data as PDF and want a file printed 10x that big. So we have to scale it to that dimensions. Factor 10 is the maximum we do here. E.G. The customer wants a banner to be printed 6m width by 2m height. The file they mostly deliver is in a vector format 600mm by 200mm. So I try to scale them to the correct dimensions in a batch process.

EDIT 2: I updated the question to the actual status

1

There are 1 answers

2
Kurt Pfeifle On

Your attempt to create a 708662 pixels wide and 157480 pixels high TIFF is crazy!

A little bit of calculation should tell you that these are ~104 GigaPixels!

Given that you also requested tiff32nc output, this requires 32 bits (4 Bytes) per Pixel (8 bits for each of the requested CMYK channels).

Do you even have 416 GigaByte of harddisk space on that system, let alone 416 GigaByte of RAM?!? (I'm hoping you are not on a 32bit system...) How do you intend to handle that file for further processing if you indeed succeed to generate it?!? Which graphic/image processing software will even start to open it?!?


In short: I'm not at all surprised you're running into problems when trying to get Ghostscript to produce such a monster!

(Also: Do not use -rXXX when you also use -gNNNxMMM. -gNNNxMMM does already set the absolute image dimensions in pixels -- setting -rXXX at the same time is useless.)

(Yes, I know: TIFFs are typically compressed. So my example calculation above was misleading. On purpose... However, when reading a compressed TIFF from disk, it has to be expanded in memory in order to render it....)