diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java index 3431d1c24..9f705e0e0 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java @@ -249,6 +249,8 @@ public final class XSLFPictureData extends POIXMLDocumentPart implements Picture return PictureType.WPG; } else if (XSLFRelation.IMAGE_WDP.getContentType().equals(ct)) { return PictureType.WDP; + } else if (XSLFRelation.IMAGE_TIFF.getContentType().equals(ct)) { + return PictureType.TIFF; } else { return null; } @@ -267,6 +269,7 @@ public final class XSLFPictureData extends POIXMLDocumentPart implements Picture case BMP: return XSLFRelation.IMAGE_BMP; case WPG: return XSLFRelation.IMAGE_WPG; case WDP: return XSLFRelation.IMAGE_WDP; + case TIFF: return XSLFRelation.IMAGE_TIFF; default: return null; } } diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java index 2d7402f71..95d407a02 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java @@ -32,6 +32,7 @@ import java.util.Map; import org.apache.poi.POIDataSamples; import org.apache.poi.sl.usermodel.PictureData.PictureType; +import org.apache.poi.util.IOUtils; import org.apache.poi.xslf.XSLFTestDataSamples; import org.junit.Test; import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture; @@ -193,4 +194,18 @@ public class TestXSLFPictureShape { assertTrue(ppt2.getPictureData().isEmpty()); ppt2.close(); } + + @Test + public void testTiffImageBug59742() throws Exception { + XMLSlideShow slideShow = new XMLSlideShow(); + final InputStream tiffStream = _slTests.openResourceAsStream("testtiff.tif"); + final byte[] pictureData = IOUtils.toByteArray(tiffStream); + IOUtils.closeQuietly(tiffStream); + + XSLFPictureData pic = slideShow.addPicture(pictureData, PictureType.TIFF); + assertEquals("image/tiff", pic.getContentType()); + assertEquals("image1.tiff", pic.getFileName()); + + slideShow.close(); + } } \ No newline at end of file diff --git a/test-data/slideshow/testtiff.tif b/test-data/slideshow/testtiff.tif new file mode 100644 index 000000000..99e6bdeb7 Binary files /dev/null and b/test-data/slideshow/testtiff.tif differ