stomcavage
stomcavage

Reputation: 1059

File size converting pdf to tiff

I'm using ghostscriptSharp to convert PDF files to TIFF files for faxing. The PDF files sometimes contain photocopies of receipts.

I'm using the tiffg3 driver with a height x width of 400 x 400. I've noticed that the PDFs that contain photocopies tend to expand in size when converting to TIFFs, while the ones without those shrink in size. A typical increase that I'm seeing is going from 1 MB to 25 MB.

I've tried adding compression to the TIFF, but then the fax process can't read it. Is there a way to reduce the output size in ghostscriptSharp without reducing the resolution?

Upvotes: 1

Views: 1497

Answers (3)

KenS
KenS

Reputation: 31141

Creating a bitmap, even a low resolution monochrome bitmap, is likely to be larger than a vector-based description language.

Consider:

(Hello World) Tj

That's 16 bytes in a PDF file, and it doesn't change if you change the font size. If you turn it into a bitmap, even at low resolution and compressed, it probably exceeds that size.

That's why rendering a page description language to a bitmap produces larger files and is one of the reasons for using a page description language for printing, instead of sending large bitmaps around.

The tiffg3 and tiffg4 devices in Ghostscript only produce monochrome output, because that's all you can encode with G3 and G4 encoding. TIFF G3 is already compressed using the Fax CCITT group 3 compression scheme (Group 3 = g3). If you try to compress that using some other scheme, then your fax software won't be able to read it.

You could try using CCITT Group 4 fax compression instead (the tiffg4 device) but if that doesn't help then basically that's what you get. Your only other option is to create the TIFF at a lower resolution. You don't say what resolution you are currently using. Fax normally supports 3 resolutions; 408x391, 204x196 and 204x98. If you are using superfine (408x391) then you could switch to a lower resolution.

I'm at a loss to see why this is a problem, since you are sending the files by fax anyway, why do you care how large an intermediate TIFF file you get ?

Upvotes: 1

Goose
Goose

Reputation: 546

If your toolkit allows encoding options, for faxing, your best bet will be to produce a bitonal (black and white) tiff with Group 4 encoding. The downside of that compression scheme is that the more "gray" you have (typical with color pictures converted to grayscale), the bigger your file will be, otherwise, for most things, the compression ratio will be just fine.

Upvotes: 0

Mark Adelsberger
Mark Adelsberger

Reputation: 45659

If compression won't work and you can't reduce resolution, then the only remaining option would be color depth. It's plausible that the conversion could be using more colors when a photocopy is attached (because of gradients in shadows, or the particular color of the paper, or whatever); yet the receipt might be totally readable without all the colors (as long as the "ink" shows up as distinct from the "paper").

If your conversion tool has a setting for selecting a color depth, tinkering with that is likely your best bet.

Upvotes: 0

Related Questions