Created attachment 34536 [details] A test PPT with an image used twice, and a java code with a main to reproduce the problem If the same picture is referenced twice in a slide (with 2 XSLFPictureShape), deleting one of the XSLFPictureShape will corrupt the slide. By corrupted, I mean that PowerPoint won't be able to load the slide and it will replace its content with a blank slide. I am guessing that XSLF always deletes the image file along with the XSLFPictureShape. What should be done is deleting the image file only if it is not used by other XSLFPictureShape elements. To create a slide with the same picture referenced twice: 1. insert a picture in a slide, 2. copy and past the inserted picture in the current slide. The same picture should be duplicated in the slide. I have put attached a zip file with: - a PPT with one slide and an image used twice in that slide, - a java class with a small main() to reproduce the probleme.
I regard the original issue as invalid - if you have multiple references to the same part (e.g. a png image), you would have each time a new relationship - i.e. relationships aren't reused. I have to admit, that I haven't search the ECMA spec for this definition, but if you do the same manually via MS/Libre Office you actually get not only a copied relationship but also a second media part. After I adopted your sample to this handling, the resulting pptx was still corrupt as the POIXMLDocumentPart.removeRelation(POIXMLDocumentPart) method didn't handle multiple references correct. This was fixed via r1808661