PDF Optimizer

Images

We describe separately the parameters to use for color, grayscale, and monochrome images.

Resampling Images

If you have photographs or other kinds of graphics images embedded in a PDF document that you want to make smaller, and you know that these images don’t need to have a high resolution in the output file, you can reduce the resolution of these images. You can also compress these images within the file. Both steps will reduce the final size of the PDF document.

In PDF Optimizer, this process is called resampling. You can choose to resample color images in a PDF document, or grayscale, or monochrome (black & white). The settings for reducing the resolution for these three kinds of images in a PDF document must be added separately to the JSON profile file. Each type of graphic can have its own settings and resolution values. So you could, for example, enable resampling to only apply to the color images in a PDF document. Or you could include only grayscale and black and white images.

Downsampling and Recompression

The resampling process that PDF Optimizer uses involves downsampling and recompression. Downsampling reduces the size of the image directly by reducing the resolution. In recompression, compressed images in a document are expanded and then compressed again. You can enter a recompression setting to change the compression algorithm used for recompression, such as ZIP, JPEG or Flate, and another setting to change the final image quality after recompression is complete. The image quality is part of the compression method used.

Downsampling will decompress and then recompress images in a document, because any image must be decompressed first before it can be downsampled. Then it recompresses the image. If you add settings in the JSON profile file to downsample images, PDF Optimizer will also recompress the images involved whether you provide recompression settings or not.

If you do not add recompression settings to the JSON profile, PDF Optimizer downsamples and recompresses each image in the PDF document using the default compression algorithm and quality value defined in the image itself. For example, if you provide downsample settings but not recompression settings in your JSON profile, and apply that profile to a document that only holds JPEG images, PDF Optimizer will use the JPEG compression method. It will also use the highest quality recompression setting available (“maximum”) to keep from reducing the quality of the images as they are recompressed.

On the other hand, if you decide to leave out downsample settings from your JSON profile file, but add recompression settings, PDF Optimizer will recompress the images using the recompression algorithm you provide while keeping the image downsampling resolution (DPI) the same. Note that if you add recompression settings you must include both values in the JSON file, the compression algorithm and the recompression quality level.

Image Resolution

When we refer to the resolution of an image, we generally refer to the number of pixels in that image. This can be expressed in terms of megapixels, or in Dots per Inch (DPI). With an image in a PDF document, the resolution of the image is expressed as a certain number of pixels wide and pixels high. The downsampling process involves changing the width and height of an image in pixels, in order to reach a given target resolution. PDF Optimizer calculates the resolution for every image in the document. Keep in mind that the resolution values used with downsampling are distinct from the image quality settings used for image recompression.

If the same image appears multiple times within a single PDF document, and the document is downsampled, PDF Optimizer downsamples every copy of this image. The system uses the version of the image with the highest resolution as the reference point for downsampling for all of the other copies of this same image.

You can specify a target resolution to use for downsampling images in a document (target-dpi) and a trigger resolution (trigger-dpi). If you decide to downsample a type of image, both the target and the trigger resolution settings must be included in your profile file. The target resolution defines the goal—the maximum resolution for every image in the file. So if you add a target resolution to your JSON profile and set that target resolution to 600 DPI, PDF Optimizer will downsample every graphic in the PDF document to 600 DPI unless it that image is already at 600 DPI or less.

The trigger resolution, if used, defines the resolution PDF Optimizer uses as its starting point. Any image with a resolution greater than the trigger resolution will be downsampled. If an image has a resolution less than the trigger resolution, PDF Optimizer ignores it.

So if you set the trigger resolution to 800 DPI, and the target resolution to 400 DPI, it means that you want to downsample every image in the PDF document to 400 DPI, but only if the image is larger than 800 DPI to begin with. In this example you would be telling PDF Optimizer to look for only the really large images (the ones with a resolution at 800 DPI or more) and then downsample just those images to a certain set value, in this example 400 DPI.

If the trigger resolution is 500 DPI, and the target resolution is 400 DPI, PDF Optimizer will not downsample an image if it is 480 DPI. But if the trigger resolution is 500 and the target is 400, if PDF Optimizer finds an image with a resolution of 680 DPI, it will downsample it to 400 DPI.

A Few Examples of JSON Profile Settings

This example shows settings used to downsample and recompress color JPEG images in a PDF document:

        "color": {
            "downsample": {
                "trigger-dpi": 225,
                "target-dpi": 150
            },
            "recompress": {
                "type": "jpeg",
                "quality": "medium"
            }
        },

Here images with a resolution above 225 DPI will be resized to 150 DPI, using the JPEG compression algorithm and set at “medium” quality. The quality levels (low, medium, high) are defined within the JPEG algorithm itself.

In this example, we don’t provide recompress settings.

        "color": {
            "downsample": {
                "trigger-dpi": 225,
                "target-dpi": 150
            },
        },

PDF Optimizer will use the same compression algorithm, JPEG, because these types of images are by default JPEG compressed. But the quality setting will be “Maximum” because the software tries to maintain the same level of compression quality as found in the original JPEG images.

Finally, consider this example:

        "color": {
            "downsample": {
                "trigger-dpi": 225,
                "target-dpi": 150
            },
            "recompress": {
                "type": "zip"
                "quality": "medium"
            }
        },

This refers to the same type of image in the PDF document, color JPEG images. PDF Optimizer will downsample the color images to 150 DPI if they are above 225 DPI, but uses the ZIP compression algorithm, rather than using the default JPEG compression method.