Reduce image quality
Leave feedback
On this page
If the output PDF file contains images, you can reduce its size using image compression.
To enable image compression, set the compress_images property to True
. The GroupDocs.Viewer compresses all images in the file.
The image_quality property determines the compression ratio. It is a quality value in percent. 100% means original quality.
The following code snippet shows how to compress images in the file:
with gv.Viewer("sample.docx") as viewer:
viewOptions = gvo.PdfViewOptions()
viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions()
viewOptions.pdf_optimization_options.compress_images = True
viewOptions.pdf_optimization_options.image_quality = 50
viewer.view(viewOptions)
The following image demonstrates the result:
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.