gwlucastrig commented on a change in pull request #106:
URL: https://github.com/apache/commons-imaging/pull/106#discussion_r522427442
##########
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:
The main reason I checked for actual alpha is that I'd seen a bunch of
images of TYPE_INT_ARGB that had all the alpha values set to 0xff anyway. I
thought it would help reduce the size of the output file to leave it out if the
image didn't actually use transparency.
Also, I've seen a bug in java's ImageIO class where if you try to store a
BufferedImage of TYPE_INT_ARGB to a JPEG file, Java messes up the color. That
bug has been there like forever... So I thought that it might avoid bugs for
applications if by storing our TIFFs so that when they got read into
BufferedImages by an application they would end up just simple TYPE_INT_RGB.
That way, an application that used Commons Imaging to read a TIFF and then
ImageIO to write a JPEG might have better luck.
----------------------------------------------------------------
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]