pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1868780 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
Date Wed, 23 Oct 2019 03:51:01 GMT
Author: tilman
Date: Wed Oct 23 03:51:01 2019
New Revision: 1868780

URL: http://svn.apache.org/viewvc?rev=1868780&view=rev
Log:
PDFBOX-4672: check transparency too, because our "fast path" createFromGrayImage() doesn't
handle them

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java?rev=1868780&r1=1868779&r2=1868780&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/LosslessFactory.java
Wed Oct 23 03:51:01 2019
@@ -79,8 +79,9 @@ public final class LosslessFactory
     public static PDImageXObject createFromImage(PDDocument document, BufferedImage image)
             throws IOException
     {
-        if ((image.getType() == BufferedImage.TYPE_BYTE_GRAY && image.getColorModel().getPixelSize()
<= 8)
-                || (image.getType() == BufferedImage.TYPE_BYTE_BINARY && image.getColorModel().getPixelSize()
== 1))
+        if (image.getTransparency() == BufferedImage.OPAQUE &&
+                ((image.getType() == BufferedImage.TYPE_BYTE_GRAY && image.getColorModel().getPixelSize()
<= 8)
+                || (image.getType() == BufferedImage.TYPE_BYTE_BINARY && image.getColorModel().getPixelSize()
== 1)))
         {
             return createFromGrayImage(image, document);
         }



Mime
View raw message