Link Search Menu Expand Document

Adjusting PDF compression options and optimization configurations

pdf/optimize function can compress input PDF into up to x13 smaller file size by compressing images and objects inside.

You can adjust compression options via profiles parameter that allows setting custom configurations.

profiles configuration is the JSON string {...}. For example:

{ 'ImageOptimizationFormat': 'JPEG', 'JPEGQuality': 25, 'ResampleImages': true, 'ResamplingResolution': 120, 'GrayscaleImages': false }

** profiles configuration variables**

  • ImageOptimizationFormat - (optional) controls image compression format. Available values:
    • JPEG (default) JPEG based compression;
    • Flate (zip-like compression);
    • Fax - 1-bit black and white compression, provides best file size;
  • JPEGQuality - (optional) controls JPEG compression quality from 1 (worst quality, smallest size) to 100 (best quality, largest size). Set to 25 by default.

  • ResampleImages - (optional) tells the compressor to resample images to a new resolution. true by default.

  • ResamplingResolution - (optional) target resampled images resolution. 120 by default (120 dots per inch).

  • GrayscaleImages - (optional) turns all images into grayscale. Not affecting the compression but useful if you need to make all images inside grayscale. False by default.

Compression Tests

4 page scanned PDF

4 page PDF with images, one image per page.

Input Sizeprofiles configurationOutput SizeOutput/Input %
566KBdefault (none)366KB64.66%
566KB{ 'JPEGQuality': 10}306KB54.06%
566KB{ 'ImageOptimizationFormat': 'Fax'}42KB7.42%

12-page presentation with text, drawings and images

12-page pdf presentation created and exported from Google Slides.

Input Sizeprofiles configurationOutput SizeOutput/Input %
3,169KBdefault (none)1,654KB52.19%
3,169KB{ 'JPEGQuality': 10}1,352KB42.66%
3,169KB{ 'ImageOptimizationFormat': 'Fax'}759KB23.95%
3,169KB{ 'ResamplingResolution': 72}1,552KB48.97%
3,169KB{ 'JPEGQuality': 10, 'GrayscaleImages': true}1,358KB42.85%

Example for settingprofiles in a direct API request

POST v1/pdf/optimize

"url": "",
"profiles": "{ 'ImageOptimizationFormat': 'JPEG', 'JPEGQuality': 25, 'ResampleImages': true, 'ResamplingResolution': 120, 'GrayscaleImages': false }",
"async": false

"url": "",
"pageCount": 5,
"error": false,
"status": 200,
"name": "sample-compressed.pdf",
"credits": 105,
"duration": 3023,
"remainingCredits": 5668833

Setting profiles in Zapier, Integromat/Make or other plugins

Find the PDF Compressor module and set profiles field as the following custom configuration:

{ 'ImageOptimizationFormat': 'JPEG', 'JPEGQuality': 25, 'ResampleImages': true, 'ResamplingResolution': 120, 'GrayscaleImages': false }

If PDF Compressor module is not available then consider using the Custom API Call module instead.

Setting profiles in Zapier, Integromat/Make or others in Custom API Call module

In the Custom API Call module set profiles parameter as in the following sample configuration:

{ 'ImageOptimizationFormat': 'JPEG', 'JPEGQuality': 25, 'ResampleImages': true, 'ResamplingResolution': 120, 'GrayscaleImages': false }