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



##########
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:
       I've got some comments that I will incorporate into the code in my next 
PR.  Unfortunately, once again I've broken git and I can't get it to accept 
more changes to the current PR.  Clearly, there is something systematic I'm 
doing wrong and I am trying to figure out what that is.
   
   In the meantime...  Here's the text I've written.  It would go into 
TiffImageWriterBase.java right before the call to checklForActualAlpha.
   
          // If the source image has a color model that supports alpha,
           // this module performs a call to checkForActualAlpha() to see 
whether
           // the image that was supplied to the API actually contains
           // non-opaque data in its alpha channel.  It is common for 
applications
           // to create a BufferedImage using TYPE_INT_ARGB, and fill the entire
           // image with opaque pixels. In such a case, the file size of the 
output
           // can be reduced by 25 percent by storing the image in an 3-byte RGB
           // format. This approach will also make a small reduction in the 
runtime
           // to read the resulting file when it is accessed by an application.
   
   




----------------------------------------------------------------
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