amit
amit

Reputation: 2331

How to convert a pdf with Ghostscript so the images will be encoded in CCITT

I'm trying to reduce the size of a pdf file by converting its images from color/gray to B/W and re-encode those images using the more efficient CCITT Group 4 or JBIG2 encoding.

Can it be done via Ghostscript? How? If not, is there another CLI tool that can help?

Upvotes: 1

Views: 781

Answers (2)

K J
K J

Reputation: 11846

Yes Ghostscript can be used many ways with MonoChrome Group 4 compression. Halftone/Dithered will be needed for GreyTones.

CCITT g4 is a highly efficient Monochrome FaX scanner / printer format, its GhostScript device output is available as:-

-sDEVICE=faxg4 and also can be used inside a multi page tiff -sDEVICE=tiffg4 or also as individual pages via -sDEVICE=tiffsep1

it can also be specified using -sCompression=g4

see https://ghostscript.com/doc/current/Devices.htm#fax

and https://ghostscript.com/doc/current/Devices.htm#TIFF

Ghostscript JBIG2 support is uni-directional as they provide a DeCoder library for decoding JBIG2 streams in PDF files. Thus its primary focus is the set of JBIG2 features supported in PDF. So it is used in decoding for PDL outputs but not as a compression DEVICE.

Upvotes: 1

Violapterin
Violapterin

Reputation: 347

I have been looking for relevant information today, which brings me here. I think the JBIG2 encoder is not free, and Ghostscript doesn't provide that. On the other hand, for Ghostscript, CCITTFax encoder is just the default one for monochrome images.

Ghostscript, jbig2dec

Ghostscript, High Level Output Devices

Upvotes: 0

Related Questions