garydgregory commented on code in PR #334: URL: https://github.com/apache/commons-imaging/pull/334#discussion_r1391169140
########## src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java: ########## @@ -452,9 +454,21 @@ public void visitSos(final int marker, final byte[] markerBytes, final byte[] im Allocator.check(Integer.BYTES * sofnSegment.width * sofnSegment.height); switch (sofnSegment.numberOfComponents) { case 4: - colorModel = new DirectColorModel(24, 0x00ff0000, 0x0000ff00, 0x000000ff); - final int[] bandMasks = { 0x00ff0000, 0x0000ff00, 0x000000ff }; - raster = Raster.createPackedRaster(DataBuffer.TYPE_INT, sofnSegment.width, sofnSegment.height, bandMasks, null); + // Special handling for the application-RGB case: TIFF files with + // JPEG compression can support an alpha channel. This extension + // to the JPEG standard is implemented by specifying a color model + // with a fourth channel for alpha. + if (useTiffRgb) { + colorModel = new DirectColorModel(32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); + final int[] bandMasks = {0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000}; Review Comment: If these constants can be refactored, sure. If that refactoring touches a lot of files, consider doing the clean-up in a new PR to make this one a smaller revert/bisect point if we need that in the future. TY! -- 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. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org