SVG Image is distored after adding to PictureFrame (Java)

Hello,

When adding a SVG-based graphic to a PictureFrame in a Slide, the resulting image becomes distorted with pixelation. This can be observed under Aspose Slides for Java version 19.12, the attached 3D_pie.svg (55.4 KB) file and the following Java code:

try {
  final String svgPath = [FILE_PATH] + "3D_pie.svg";

  IPresentation pptx = new Presentation();
  ISlideCollection slides = pptx.getSlides();
  ISlide slide = slides.get_Item(0);

  byte[] imagebytes = Files.readAllBytes(Paths.get(svgPath));
  ISvgImage svgImg = new SvgImage(imagebytes);
  IPPImage imgx = pptx.getImages().addImage(svgImg);

  slide.getShapes().addPictureFrame(ShapeType.Rectangle, 10, 10,
                                    imgx.getWidth(), imgx.getHeight(), imgx);

  String newFile = svgPath.replace(".svg", ".pptx");
  Files.deleteIfExists(Paths.get(newFile));
  pptx.save(newFile, SaveFormat.Pptx);
  System.out.println("\nSaved Presentation as: " + newFile);

} catch (Exception ex) {
  System.out.println("Unexpected exception: " + ex.getMessage());
  ex.printStackTrace();
}

After running the code, there should be a new file named “3D_pie.pptx” (also attached). When the Presentation opened in PowerPoint, the pie chart is shows pixelation. However, if you render the same “3D_pie.svg” file in any major Browser (Firefox, Edge/IE, Chrome) the SVG image appears much clearer and without distortions.

We would like for Slides to render SVG-based images as good as (or better than) the Browsers.

Thanks.

@oraspose,

I have observed the information shared by you and request you to please share the generated output presentation on your end depicting distortion. Please also share the Java and Operating system details on your end.

Hi Mudassir,
Thank you for your response. The Presentation named “3D_pie.pptx” - which was generated by the sample code on our end - is included in the 3D_pie.zip file, uploaded in the original thread.

The file was generated under a Windows 10 box using Aspose Slides for Java version 19.12 running on Java Version 1.8.0_77.

Thanks again.

@oraspose.

Thank you for sharing the information with us. I have created an issue with ID SLIDESJAVA-38009 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 notified once the issue will be fixed.

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

Thank you Mudassir!
Tested under Slides 20.4 and the SVG image looks good.

@oraspose,

Thank you very much for your valuable feedback.