Skip to content

Commit

Permalink
fix(jxl): ignore icc profile if it is not RGB
Browse files Browse the repository at this point in the history
  • Loading branch information
gotson committed Nov 8, 2023
1 parent e9b41c5 commit 8b5651f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ private void readInfo() throws IOException {
try {
info = JpegXl.getBasicInfo((ImageInputStream) input);

ColorSpace colorSpace = info.iccProfile() != null ? ColorSpaces.createColorSpace(info.iccProfile()) : ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorSpace colorSpace = ColorSpaces.createColorSpace(info.iccProfile());
if (colorSpace == null || colorSpace.getType() != ColorSpace.TYPE_RGB) colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
imageTypes = List.of(
// RGBA
ImageTypeSpecifiers.createPacked(colorSpace, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff, DataBuffer.TYPE_INT, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ protected List<TestData> getTestData() {
// Orientation: 7 (Anti-Transposed) => we need to invert the width and height
new TestData(getClassLoaderResource("/jxl/island.jxl"), new Dimension(924, 1386)),
// Animation, 12 frames
new TestData(getClassLoaderResource("/jxl/animation.jxl"), new Dimension(256, 256))
new TestData(getClassLoaderResource("/jxl/animation.jxl"), new Dimension(256, 256)),
// Grayscale ICC profile
new TestData(getClassLoaderResource("/jxl/gray.jxl"), new Dimension(1561, 2240))
);
}

Expand Down
Binary file added imageio-jxl/src/test/resources/jxl/gray.jxl
Binary file not shown.

0 comments on commit 8b5651f

Please sign in to comment.