When I try to run the example of “Create or clone existing slides from templates”, just amend the image “image.jpg” to “image.webp”, the throw NullPointerException
.
os:Windows11
version: com.aspose:aspose-slides:24.3:jdk16
code like:
Presentation pres = new Presentation();
try {
// Sets conditions for background image
pres.getSlides().get_Item(0).getBackground().setType(BackgroundType.OwnBackground);
pres.getSlides().get_Item(0).getBackground().getFillFormat().setFillType(FillType.Picture);
pres.getSlides().get_Item(0).getBackground().getFillFormat().getPictureFillFormat()
.setPictureFillMode(PictureFillMode.Stretch);
// Loads the image
IPPImage imgx = pres.getImages().addImage(Files.readAllBytes(Paths.get("image.webp")));
// Adds image to presentation's images collection
pres.getSlides().get_Item(0).getBackground().getFillFormat().getPictureFillFormat().getPicture().setImage(imgx);
// Writes the presentation to disk
pres.save("ContentBG_Img.pptx", SaveFormat.Pptx);
} catch (IOException e) {
} finally {
if (pres != null) pres.dispose();
}