Shape to BMP file not working

Hello


I am using Aspose Slide for java 15.7.0

When I tries to save Chart type shape in BMP Format. it is not getting save

PFA

Sourcecode file shapeToBMP.java
Source Presentation file All.pptx

Regards
Shubhi
Hi Shubhi,

I have observed your requirements and worked with the data shared by you. I have been able to reproduce the issue. A ticket with ID SLIDESJAVA-35120 has been logged in our issue tracking system to further investigate and resolve the issue.This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

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,

The issues you have found earlier (filed as SLIDESJAVA-35120) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.