Compress PDF files with ghostscript. GitHub Gist: instantly share code, notes, and snippets. I was trying to reduce the size of pdfs whilst ensuring that they met a certain dpi or ppi for my thesis. Reducing size of pdf with ghostscript. ?id= Bug ID: Summary: Downsampling not supporting different filters for monochrome.

Author: Zolot Dairan
Country: Andorra
Language: English (Spanish)
Genre: Literature
Published (Last): 27 April 2004
Pages: 12
PDF File Size: 10.16 Mb
ePub File Size: 17.3 Mb
ISBN: 883-5-85369-574-2
Downloads: 49898
Price: Free* [*Free Regsitration Required]
Uploader: Gagrel

For other information, see the Ghostscript overview. You may also be interested in how to build Ghostscript and install itas well as the description of the driver interface. Documentation for some older, superceded devices has been moved to another document. In general such devices are deprecated and will be removed in future versions of Ghostscript. In general all older printer drivers can be replaced by the ijs interface and one of the available 3rd party raster driver collections. We recommend moving to the ijs device for all such printing.

Several different important kinds of measures appear throughout this document: Centimeters and millimeters ISO standard paper sizes such as A4 and A3 are commonly represented in the Ghotscript units of centimeters and millimeters.

Centimeters are abbreviated cmmillimeters mm. Inches 1 inch equals 2.

The inch measure is sometimes represented by in or a quotation mark ” to the right of a measure, like 8. See in the usage documentation all the paper sizes predefined in Ghostscript.

Points Gyostscript are a measure traditionally used ghostscripg the printing trade and now in PostScript, which specifies exactly 72 points per inch approximately Dots per inch Dots per inch or dpi is the common measure of printing resolution in the US.

Bits per pixel Commonly abbreviated bpp this is the number of digital bits used to represent the color of each pixel. This is also referred to as ‘bit depth’ or ‘pixel depth’. Image file formats Ghostscript supports output to a variety of image file formats and is widely ghostsscript for rasterizing postscript and pdf files.

A collection of such formats ‘output devices’ in Ghostscript terminology are described in this section. Here are some commonly useful driver options that apply to all raster drivers.

Options specific to particular file formats are described in their respective sections below. This is a general option telling Ghostscript what to name the output.

It can either be a single filename ‘ tiger. This option sets the resolution of the output file in dots per inch. The default value if you don’t specify this options is usually 72 dpi. These options control the use of subsample antialiasing. Their use is highly recommended for producing high quality rasterizations of the input files. The size of the subsampling box n should be 4 for optimum output, but smaller values can be used for faster rendering.

Antialiasing is enabled separately for text and graphics content. Because this feature relies upon rendering the input it is incompatible, and will generate an error on attempted use, with any of the vector output devices. These suppress interactive prompts and enable some security checks on the file to be run.

Please see the Use documentation for a complete description. PNG pronounced ‘ping’ stands for Portable Network Dowmsample, and is the recommended format for high-quality images. It supports full quality color and transparency, offers excellent lossless compression of the image data, and is widely supported.

  CAMUS SISYPHOS PDF

Please see the PNG website for a complete description of the format. Ghostscript provides a variety of devices for PNG output varying by bit depth. For normal use we recommend png16m for bit Dwonsample color, or pnggray for grayscale. The pngpng16 and pngmono devices respectively provide 8-bit color, 4-bit color and black-and-white for special needs.

The pngmonod device is also a black-and-white device, but the output is formed from an internal 8 bit grayscale rendering which is then error diffused and converted down to 1bpp.

The pngalpha device is bit RGBA color with transparency indicating pixel coverage. The background is transparent dodnsample it has been explicitly filled. Text and graphics anti-aliasing are enabled by default. The pngmonodpng16mpnggray and pngalpha devices all respond to the following:.

Examples of how to use Ghostscript to convert postscript downsampld PNG image files: Ghostscript includes output drivers that can produce jpeg files from postscript or pdf images.

These are the jpeg and jpeggray devices. Please note that JPEG is a compression method specifically intended for ghostsxript images such as photographs, not for graphics, and it is therefore quite unsuitable for the vast majority of page images produced with PostScript. For anything other than pages containing simple images the lossy compression of the jpeg format will result in poor quality output regardless of the input.

The PNM portable network map family of formats are very simple uncompressed image formats commonly used on unix-like systems. They are particularly useful for testing or as input to an external conversion utility. A wide variety ghostsceipt data formats and depths is supported. Devices include pbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw yhostscript pkmraw pksm pksmraw. TIFF is a loose collection of formats, now largely superceded by PNG except in applications where backward compatibility or special compression is required.

Writing to stdout, doqnsample or other similar stream is not supported. Attempting to do so will generate an error. There are two unrelated sets of TIFF drivers. There are five color TIFF drivers that produce uncompressed output: If separation files are being produced and more than one page is being generated, the output file specification must include a format specifier e.

The equivalent CMYK color for each spot color is determined using the alternate tint transform function specified in the Separation and DeviceN color spaces.

Since this file is created based upon having color planes for each colorant, the file will correctly represent the appearance of overprinting with spot colors. Ddownsample names for the separations for the CMYK colorants are created by appending ‘.

compression – How to reduce the size of a pdf file? – Ask Ubuntu

File names for the spot color separation files are created by appending the Spot color name in ‘ ‘ and ‘. If desired the file names for the spot color separation files can be created by appending ‘.

This change is a compile time edit. The tiffsep device will automatically recognize spot colors. In this case their order is determined by when they are found in the input file. The names of spot colors may be specified via the SeparationColorNames device parameters.

Internally each spot color is assigned a spot color number. These numbers start with 0 for the first spot color. The spot color numbers are assigned ghostcript the same order as the names are printed to stderr see below.

This order also matches the ordering in the SeparationColorNames list, if this parameter is specified. The spot color numbers are not affected by the SeparationOrder parameter.

  BUDIDAYA LABU SIAM PDF

If only a subset of the colorants for a file is desired, then the separations to be output can be selected via the SeparationOrder device parameter. The tiffsep device also prints the names of any spot colors detected within a document to stderr. This provides a simple mechanism for users ghostsxript external applications to be informed about the names of spot colors within a document.

Generally Ghostscript will support a maximum of 64 process and spot colors. That is there ghkstscript be up to 64 colorants accurately handled with overprint on a single page. If more than 64 colorants are encountered, those beyond 64 will be mapped to CMYK using the alternate tint transform.

When rendering a PDF document, Ghostscript can deteremine prior to rendering how many colorants occur on a particular page. With Postscript, this is not possible in general. If you specify more than is needed, the document will render more slowly. The ideal case is to use the same number as the maximum number of spot colorants that occur on a single page of the document.

If more spot colorants are encountered than is specified by -dMaxSpots, then a warning will be printed indicating that some spot colorants will be mapped to CMYK using the alternate tint transform.

Change image compression in PDF files with ghostscript

In 1bpp mode, the device renders each component internally in 8 bits, but then converts down to 1bpp with error diffusion before output as described below in the tiffscaled device. No composite file is produced in 1bpp mode, only individual separations. The tiffscaled and tiffscaled4 devices can optionally use Even Toned Screening, rather than simple Floyd Steinberg error diffusion. This patented technique gives better quality at the expense of some speed.

While the code used has many quality tuning options, none of these are currently exposed. Any device author interested in trying these options should contact Artifex for more information. The 1 bit per component output is halftoned using the current screening set by ‘setcolorscreen’ or ‘sethalftone’ which allows for ordered dither or stochastic threshold array dither to be used. This is faster than error diffusion.

The file specified via the OutputFile command line parameter will not be created it is opened, but deleted prior to finishing each page. If the file name specified via the OutputFile parameter ends with the suffix ‘. The remaining TIFF drivers all produce black-and-white output with different compression modes: Multi-strip files reduce the memory requirement on the reader, since readers need only store and process one strip at a time. The MaxStripSize parameter controls the strip size: If the value of the MaxStripSize parameter is smaller than a single image row, then no error will be generated, and the TIFF file will be generated correctly using one row per strip.

Note that smaller strip sizes increase the size of the file by increasing the size of the StripOffsets and StripByteCounts tables, and by reducing the effectiveness of the compression which must start over for each strip.

If the value of MaxStripSize is 0, then the entire image will be a single strip. According to the TIFF 6.

Life