Aspose Slide to Image Convertion in Java Adds a Horizontal Line Artifact to a Chart

Hello. We have noticed that in some cases generated images from slides include horizontal line artifact.

Slide being converted:
image.png (2.5 KB)

Output result:
image.png (28.0 KB)
It contains blue line which doesn’t exist in our chart.

I’m attaching slides and code which was used to generate this image.

@Test
void slide_test() throws Exception {
    byte[] fileContent =
            Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("Presentation1.pptx").toURI()));
    Presentation presentation = new Presentation(new ByteArrayInputStream(fileContent));
    ISlide slide = presentation.getSlides().get_Item(0);
    RenderingOptions renderingOptions = new RenderingOptions();
    Dimension2D slideSize = presentation.getSlideSize().getSize();

    BufferedImage image = getBufferedImage(slide, (int) slideSize.getHeight(), renderingOptions);

    JpegOptions imageOptionsBase = new JpegOptions();
    imageOptionsBase.setResolutionSettings(new ResolutionSetting(300.0, 300.0));
    imageOptionsBase.setQuality(80);
    try (Image img = ImageExtensions.fromJava(image); FileOutputStream slideImage = new FileOutputStream("test.jpg")) {
        img.save(slideImage, imageOptionsBase);
        slideImage.flush();
    } catch (IOException ex) {

    }
}

private BufferedImage getBufferedImage(ISlide slide, int height, RenderingOptions renderingOptions) {
    final double SLIDE_IMAGE_DPI = 300.0;
    final int IMAGE_WIDTH = 960;
    final double HTML_DPI = 96.0;
    double scale = SLIDE_IMAGE_DPI / HTML_DPI;
    return slide.getThumbnail(renderingOptions, new Dimension(
            (int) (IMAGE_WIDTH * scale),
            (int) (height * scale)
    ));
}

I have renamed slides to zip extension, because forums doesn’t accept pptx files. Presentation1.zip (82.4 KB)

We’re using 23.3 slide version. But same issue persists with 23.6.
We’re using openjdk 17.0.4.1 2022-08-12 version.

@ANDREA.FARRIS,
Thank you for reporting on the issue. I reproduced the problem you encountered.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39232

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

The issues you found earlier (filed as SLIDESJAVA-39232) have been fixed in Aspose.Slides for Java 24.5 (JAR).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.

@ANDREA.FARRIS,
With Aspose.Slides for Java 24.5, please use the following code snippet:

Presentation presentation = new Presentation("Presentation1.pptx");
ISlide slide = presentation.getSlides().get_Item(0);

RenderingOptions renderingOptions = new RenderingOptions();
Dimension2D slideSize = presentation.getSlideSize().getSize();

IImage slideImage = getBufferedImage(slide, (int) slideSize.getHeight(), renderingOptions);
slideImage.save("output.jpg", ImageFormat.Jpeg);
private static IImage getBufferedImage(ISlide slide, int height, RenderingOptions renderingOptions) {
    final double SLIDE_IMAGE_DPI = 300.0;
    final int IMAGE_WIDTH = 960;
    final double HTML_DPI = 96.0;
    double scale = SLIDE_IMAGE_DPI / HTML_DPI;
    return slide.getImage(renderingOptions, new Dimension(
            (int) (IMAGE_WIDTH * scale),
            (int) (height * scale)
    ));
}