Optimize images

Often times PDFs created from scanned documents are generated with incorrect or unoptimal scanning settings, such as a black and white document scanned in color, or using excessive resolution. This results in PDFs with unecessarily large file sizes or documents that are difficult to read.

This tool can optimize the PDFs, reducing its images resolution and/or colors, resulting in a small file size document that does not degrade visualization or printing quality. There are many situations where reducing quality is necessary or when reducing file size is imperative.

Optimize images tool screenshot

The images optimization settings can be defined globally, to all type of images, or by type of image (i.e. different optimization settings for color images, grayscale images and black and white images). The above screenshot depicts this detailed way of specifying the optimization settings. This mode can be changed from the extra options menu, accessible by clicking the top right blue gear icon button.

The color conversion selector is used to specify if any color conversion will be executed, e.g. convert color images to grayscale or black and white.

The resample operation is used to change the image's pixels dimensions (i.e. changes the image's resolution), by percentage. So an image with 1250x800 pixels with the pixels dimensions set to 80% will result in an image with 1000x640 pixels. The resample operation uses interpolation to estimate the new pixels, with the interpolation mode selector used to specify the algorithm used.

Command line interface:

Function name: OptimizeImages
Options: [] means optional parameter
[-ByColorType] - The optimization parameters are specified by image color type.
[ConvertTo=] - The image optimization method. If the -ByColorType parameter is specified, this command is specific to the optimization of color images only.
  • BW - (default) To convert the images to black and white, using Otsu's global level method.
  • BW2 - To convert the images to black and white, using adaptive threshold.
  • Grayscale - To convert the images to grayscale.
[ResamplePercentage=] - The percentage of image resample to apply. The images will be downsampled for valued less than 100 and upsampled for values above. If the -ByColorType parameter is specified, this command is specific to the optimization of color images only.
[InterpolationMode=] - The interpolation method to apply when resampling the images. If the -ByColorType parameter is specified, this command is specific to the optimization of color images only.
  • 0 - Bilinear (default)
  • 1 - Bicubic
  • 2 - Nearest Neighbor
  • 3 - High Quality Bilinear
  • 4 - High Quality Bicubic
[ConvertGrayTo=] - The image optimization method to use with grayscale images. Only used when the -ByColorType parameter is specified.
  • BW - (default) To convert the images to black and white, using Otsu's global level method.
  • BW2 - To convert the images to black and white, using adaptive threshold.
[GrayResamplePercentage=] - The percentage of image resample to apply when resampling grayscale images. Only used when the -ByColorType parameter is specified.
[GrayInterpolationMode=] - The interpolation method to apply when resampling grayscale images. Only used when the -ByColorType parameter is specified.
[BWResamplePercentage=] - The percentage of image resample to apply when resampling black and white images. Only used when the -ByColorType parameter is specified.
[BWInterpolationMode=] - The interpolation method to apply when resampling black and white images. Only used when the -ByColorType parameter is specified.
[LossyCompressionQuality=] - To specify the compression quality to apply when compressing the images with a lossy compression algorithm.
  • 0 - Minimum
  • 1 - Low
  • 2 - Medium (default)
  • 3 - High
  • 4 - Maximum
[OutputPath=] - Full path where to place the optimized files. If not specified, file source path will be used instead
[-CreateBackup] - To backup rename the source PDF.
[-s] - Silent mode. Run without showing the interface (only available for licensed users)
fileslist - List of files to process with the script. Separate multiple files using the semicolon ";" char. Must be the last parameter
 
Examples:
- Convert all images to grayscale
"c:\Program Files\PDF-ShellTools\PDFShellTools.exe" OptimizeImages ConvertTo=Grayscale -s c:\PDFs\*.PDF

- Convert color images to grayscale, and downsample black and white images to 75%
"c:\Program Files\PDF-ShellTools\PDFShellTools.exe" OptimizeImages -ByColorType ConvertTo=Grayscale BWResamplePercentage=75 -s c:\PDFs\*.PDF

 

(c) 2006-2017 RTT