gwlucastrig commented on a change in pull request #106:
URL: https://github.com/apache/commons-imaging/pull/106#discussion_r522428929



##########
File path: 
src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
##########
@@ -287,7 +330,20 @@ public void writeImage(final BufferedImage src, final 
OutputStream os, Map<Strin
         final int width = src.getWidth();
         final int height = src.getHeight();
 
-        int compression = TIFF_COMPRESSION_LZW; // LZW is default
+        final ColorModel cModel = src.getColorModel();
+        final boolean hasAlpha = cModel.hasAlpha() && checkForActualAlpha(src);

Review comment:
       Also, the ImageWriterBase always reads the whole image into memory.  
That's one of my motivations for coming up with a new generation of image 
writer class in the JIRA item I posted recently.  The checkForActualAlpha has 
logic so that it reads a huge image in parts, so that limits the memory a 
little. Still, you are correct that it does mean two passes through the image 
data. But I think it is probably worth it to produce a smaller image on output.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to