ImageCompressionOptions ImageQuality possible values

Hello,

We are using Aspose.PDF.Drawing 25.2.

What are the possible values of ImageCompressionOptions ImageQuality?

@tfipsrd

The ImageQuality property in the ImageCompressionOptions class of Aspose.PDF.Drawing allows you to specify the level of image compression when images are being compressed. The possible values for ImageQuality are typically integers ranging from 0 to 100, where:

  • 0 indicates the lowest quality (highest compression).
  • 100 indicates the highest quality (lowest compression).

In practice, you can set the ImageQuality to a value that balances the desired image quality with the file size reduction you aim to achieve. For example, setting it to a lower value will result in a smaller file size but may degrade the image quality, while a higher value will preserve more detail but result in a larger file size.

Here is a sample code snippet demonstrating how to set the ImageQuality when optimizing a PDF document:

var pdfDocument = new Document("path/to/your/document.pdf");

var optimizationOptions = new Aspose.Pdf.Optimization.OptimizationOptions();
optimizationOptions.ImageCompressionOptions.CompressImages = true;
optimizationOptions.ImageCompressionOptions.ImageQuality = 50; // Set to desired quality level

pdfDocument.OptimizeResources(optimizationOptions);
pdfDocument.Save("path/to/optimized/document.pdf");

In this example, the ImageQuality is set to 50, which provides a moderate level of compression while maintaining reasonable image quality. Adjust this value according to your specific needs.

Thanks.

What are the possible values of OptimizationOptions LinkDuplicateStreamsScanLevel?

@tfipsrd

We are not sure that we understand your question clearly. The operation is executed by the API internally and you can only set true/false value against this flag.

According to documenytation, it is an int. So I’m wondering what are the possible values.

@tfipsrd

We are gathering related details and will get back shortly.