We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to change the quality of generated pictures

public static void main(String[] args) {
Presentation pres = new Presentation(“aaa.pdf”);
try {
// Render presentation to images array slide by slide
for (int i = 0 ; i < pres.getSlides().size(); i++)
// Control hidden slides (do not render hidden slides)
if (pres.getSlides().get_Item(i).getHidden())
BufferedImage bmp = pres.getSlides().get_Item(i).getThumbnail(2f, 2f);
// Create file name for an image
String outputFilePath = “aaa.jpg”;

            final Instant now = Instant.now();
            File file = new File(outputFilePath);
            ImageIO.write(bmp, "jpg",file);
    } catch (Exception e) {
        throw new RuntimeException(e);

Thank you for the query. Unfortunately, Aspose.Slides still cannot load PDF files. I checked the image quality using conversion the same way for a presentation (PPTX -> Bitmap -> JPG) and found it perfect.

If you found an issue, please share and specify the following:

  • input presentation file
  • output image file
  • OS version on which this code was executed
  • JDK version

Maybe you have misunderstood what I mean. I think aspose has done a good job, but now I want to reduce the quality of the jpg images produced to reduce the size of the generated images, so is there any better way?

Thank you for the additional information. I will answer you as soon as possible.

To reduce the quality of JPG images, please try to use the next way:

Presentation presentation = new Presentation(dataPath + "in.pptx");
ISlide slide = presentation.getSlides().get_Item(0);
BufferedImage image = slide.getThumbnail(2f, 2f);

JPEGImageWriteParam jpegParams = new JPEGImageWriteParam(null);

final ImageWriter writer = ImageIO.getImageWritersByFormatName("jpg").next();
writer.setOutput(new FileImageOutputStream(new File(dataPath + "out.jpg")));

writer.write(null, new IIOImage(image, null, null), jpegParams);

Our documentation will be improved later.