You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2020/11/17 05:24:39 UTC
[commons-imaging] 02/04: [Imaging-216] Updated documentation for
TIFF writer base class
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit 0265f93162ec441aaeb78d497fd919296a0b490a
Author: gwlucastrig <co...@gmail.com>
AuthorDate: Sun Nov 15 13:21:45 2020 -0500
[Imaging-216] Updated documentation for TIFF writer base class
---
.../imaging/formats/tiff/write/TiffImageWriterBase.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
index ec890fd..43c8da4 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
@@ -330,9 +330,19 @@ public abstract class TiffImageWriterBase {
final int width = src.getWidth();
final int height = src.getHeight();
+ // 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.
final ColorModel cModel = src.getColorModel();
final boolean hasAlpha = cModel.hasAlpha() && checkForActualAlpha(src);
+
// 10/2020: In the case of an image with pre-multiplied alpha
// (what the TIFF specification calls "associated alpha"), the
// Java getRGB method adjusts the value to a non-premultiplied