Created Date: Nov 27, 2020 09:44
Last Modifed Date: Nov 27, 2020 09:44


Introduction

When using makoconverter with output parameters that control image downsampling, the results are not always as expected. This may be because the image content is a masked image. For example, converting a PDF containing 300dpi color images, one might expect to use:

Downsampling

makoconverter MyInput.pdf MyOutput.pdf ColorImageDownsamplingResolution=96 ColorImageDownsamplingThreshold=96
CODE

However, masked color images will not be downsampled. Instead, it's necessary to downsample the mask, and Mako will apply the same downsampling to the related image. Use these parameters to achieve that end.

Settings to retain the mask at 1-bit per pixel

makoconverter MyInput.pdf MyOutout.pdf MonoImageDownsamplingResolution=96 MonoImageDownsamplingThreshold=96 MonoImageDownsamplingMethod=subsample
CODE

Setting the downsampling method ensures the mask can be compressed correctly (using CCITT) for the output, but this means a hard edge to the mask. To retain as a soft mask, use the following alternative:

Settings to retain a soft mask, ie 8-bits per pixel

makoconverter MyInput.pdf MyOutout.pdf MonoImageDownsamplingResolution=96 MonoImageDownsamplingThreshold=96 GrayImageCompression=flate
CODE

These settings can be combined to cover both cases.

Image downsampling

makoconverter MyInput.pdf MyOutput.pdf ColorImageDownsamplingResolution=96 ColorImageDownsamplingThreshold=96 MonoImageDownsamplingResolution=96 MonoImageDownsamplingThreshold=96 GrayImageCompression=flate
CODE

Controlling downsampling of the mask and image separately

A setting introduced in Mako 4.6.0 and later allows the mask and the image to be treated separately (that is, the image and the mask could be downsampled to different resolutions).

For example:

Use of UseMaskResolutionForMaskedImages

makoconverter MyInput.pdf MyOutput.pdf UseMaskResolutionForMaskedImages=false MonoImageDownsamplingResolution=72 MonoImageDownsamplingThreshold=72 GrayImageCompression=flate ColorImageDownsamplingResolution=150 ColorImageDownsamplingThreshold=150  
CODE

These settings would result in the image resampled to 150dpi while the mask is at 72dpi.