Hi Shubhi,
Thank you for being patient.
I would like to share with you that, The shape thumbnails are drawn on transparent background. But transparency is not supported by bmp and jpeg formats. To save a shape thumbnail to these formats you need to convert it to non-transparent image, as in the code below:
Presentation ppt = new Presentation(path + “all.pptx”);try { ISlide slide = ppt.getSlides().get_Item(0); for (IShape shape : slide.getShapes()) if (shape instanceof IChart) { BufferedImage image = shape.getThumbnail(ShapeThumbnailBounds.Appearance, 1.0f, 1.0f); // Converting to non-transparent image with white background // for Bmp and Jpeg formats BufferedImage convertedImg = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_RGB); convertedImg.getGraphics().drawImage(image, 0, 0, Color.WHITE, null); File outputBmpImage = new File(path + “chart_” + UUID.randomUUID() + “.bmp”); ImageIO.write(convertedImg, “bmp”, outputBmpImage); File outputJpegImage = new File(path + “chart_” + UUID.randomUUID() + “.jpeg”); ImageIO.write(convertedImg, “jpeg”, outputJpegImage); }} catch (IOException ex) { ex.printStackTrace();
I hope this will be helpful. Please share if I may help you further in this regard.
Best Regards,