-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BufferedImage uses an sRGB ColorModel by default. If a slide pyramid or associated image has an ICC profile, attach a ColorModel containing that profile to all BufferedImages produced from that image. Callers of paintRegionARGB() don't receive a BufferedImage. For those users, add OpenSlide.getColorModel() so the profile can be read separately. Graphics2D's documentation suggests that it handles color management, but its drawImage() method apparently does not. If we therefore manually invoke a ColorConvertOp in paintRegion(), the DICOM/Leica-4 test slide throws an exception: Exception in thread "AWT-EventQueue-0" java.awt.color.CMMException: LCMS error 13: Couldn't link the profiles at java.desktop/sun.java2d.cmm.lcms.LCMS.createNativeTransform(Native Method) at java.desktop/sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:113) at java.desktop/sun.java2d.cmm.lcms.LCMSTransform.doTransform(LCMSTransform.java:114) at java.desktop/sun.java2d.cmm.lcms.LCMSTransform.colorConvert(LCMSTransform.java:149) at java.desktop/java.awt.image.ColorConvertOp.ICCBIFilter(ColorConvertOp.java:350) at java.desktop/java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:277) at org.openslide.OpenSlide.paintRegion(OpenSlide.java:326) [...] It seems that ColorConvertOp always uses perceptual rendering intent, not the default intent encoded in the profile: https://bugs.openjdk.org/browse/JDK-8216369 Not all profiles support perceptual rendering, which may be the cause of the exception. If we're going to automatically perform color conversion, we should do it predictably, not just when the Java CMS glue happens to do the right thing. For now, don't try to do color conversion, either in paintRegion() or any of the GUI code. Closes: #53 Signed-off-by: Benjamin Gilbert <[email protected]>
- Loading branch information
Showing
2 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters