Created Date: 27 Nov, 2020 09:44
Last Modifed Date: 30 Nov, 2021 12:42
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:
makoconverter MyInput.pdf MyOutput.pdf ColorImageDownsamplingResolution=96 ColorImageDownsamplingThreshold=96
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
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
These settings can be combined to cover both cases.
makoconverter MyInput.pdf MyOutput.pdf ColorImageDownsamplingResolution=96 ColorImageDownsamplingThreshold=96 MonoImageDownsamplingResolution=96 MonoImageDownsamplingThreshold=96 GrayImageCompression=flate
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).
Use of UseMaskResolutionForMaskedImages
makoconverter MyInput.pdf MyOutput.pdf UseMaskResolutionForMaskedImages=false MonoImageDownsamplingResolution=72 MonoImageDownsamplingThreshold=72 GrayImageCompression=flate ColorImageDownsamplingResolution=150 ColorImageDownsamplingThreshold=150
These settings would result in the image resampled to 150dpi while the mask is at 72dpi.