///将图像添加到演示文稿中
int idx =(int)ppt.addPicture(picture,XSLFPictureData.PictureType PNG);
///创建带有给定图片的幻灯片
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.sl.usermodel.PictureData;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFPictureData;
import org.apache.poi.xslf.usermodel.XSLFPictureShape;
import org.apache.poi.xslf.usermodel.XSLFSlide;
public class Exe2 {
public static void main(String args[]) throws IOException {
//creating a presentation
XMLSlideShow ppt = new XMLSlideShow();
//creating a slide in it
XSLFSlide slide = ppt.createSlide();
//reading an image
File image = new File("E:/pix/xxx/aaa.jpg");
//converting it into a byte array
byte[] picture = IOUtils.toByteArray(new FileInputStream(image));
//adding the image to the presentation
int idx =(int) ppt.addPicture(picture, XSLFPictureData.PictureType PNG );
//creating a slide with given picture on it
XSLFPictureShape pic = slide.createPicture(idx);
//creating a file object
File file = new File("C:/AddingimageToPPT.pptx");
FileOutputStream out = new FileOutputStream(file);
//saving the changes to a file
ppt.write(out);
System.out.println("image added successfully");
out.close();
} } ERROR.PNG
rESOURCE: https://www.tutorialspoint.com/javaexamples/add_image_to_slide_ppt.htm