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.