Class ImageResolutionOptimizer
- Namespace
- SoftZenPdf.Optimizer
- Assembly
- SoftZenPdf.Optimizer.dll
Reduces images that have more pixels than the size they are drawn at needs, like Acrobat's "downsample to 150 ppi for images above 225 ppi". How large each image is drawn is measured from the page content; an image drawn more than once is sized for its largest use, and one also used somewhere that cannot be measured (an annotation, pattern or glyph) is left alone. Reduced JPEGs are re-encoded as JPEG at their original quality; other images stay lossless. 1, 2, 4 and 16-bit images, palette images, stencil masks and images with colour-key masks are not resized, since averaging would invent sample values they cannot hold.
public sealed class ImageResolutionOptimizer : OptimizationHandler
- Inheritance
-
ImageResolutionOptimizer
- Inherited Members
Examples
optimizer.AddOptimizationHandler(new ImageResolutionOptimizer(150));
Constructors
- ImageResolutionOptimizer(double)
Creates the handler.
Properties
- JpegQuality
The quality reduced JPEGs are saved at, greater than 0 and at most 1; null (the default) keeps the quality the original was saved at.
- MaxResolution
The resolution, in pixels per inch, images are reduced to.
- Threshold
Only images above MaxResolution times this are reduced, so images just over the target are not resampled for little gain. Defaults to 1.5 (with 150 ppi: reduce images above 225 ppi).