# HG changeset patch # User robcast # Date 1324483348 -3600 # Node ID 776347921bece6aa7ee57f99dc6c615147e030a2 # Parent 065dd6895ce7b25116e41666c8c902d4ef2ef3ab fixed slowness of tiff with color profile by loading into srgb. diff -r 065dd6895ce7 -r 776347921bec common/src/main/java/digilib/image/ImageLoaderDocuImage.java --- a/common/src/main/java/digilib/image/ImageLoaderDocuImage.java Wed Dec 21 17:01:13 2011 +0100 +++ b/common/src/main/java/digilib/image/ImageLoaderDocuImage.java Wed Dec 21 17:02:28 2011 +0100 @@ -47,6 +47,7 @@ import javax.imageio.ImageIO; import javax.imageio.ImageReadParam; import javax.imageio.ImageReader; +import javax.imageio.ImageTypeSpecifier; import javax.imageio.ImageWriteParam; import javax.imageio.ImageWriter; import javax.imageio.stream.FileImageInputStream; @@ -311,8 +312,8 @@ return reader; } - /* Load an image file into the Object. */ - public void loadSubimage(ImageInput ii, Rectangle region, int prescale) + /* Load an image file into the Object. */ + public void loadSubimage(ImageInput ii, Rectangle region, int prescale) throws FileOpException { logger.debug("loadSubimage"); this.input = ii; @@ -325,6 +326,16 @@ if (prescale > 1) { readParam.setSourceSubsampling(prescale, prescale, 0, 0); } + // try to restrict target color space to sRGB + for (Iterator i = reader.getImageTypes(0); i.hasNext(); ) { + ImageTypeSpecifier type = (ImageTypeSpecifier) i.next(); + ColorSpace cs = type.getColorModel().getColorSpace(); + if (cs.isCS_sRGB()) { + logger.debug("loadSubimage: substituted sRGB destination type "+type); + readParam.setDestinationType(type); + break; + } + } // read image logger.debug("loading.."); img = reader.read(0, readParam); diff -r 065dd6895ce7 -r 776347921bec servlet3/src/main/java/digilib/servlet/Scaler.java --- a/servlet3/src/main/java/digilib/servlet/Scaler.java Wed Dec 21 17:01:13 2011 +0100 +++ b/servlet3/src/main/java/digilib/servlet/Scaler.java Wed Dec 21 17:02:28 2011 +0100 @@ -31,7 +31,7 @@ private static final long serialVersionUID = 5289386646192471549L; /** digilib servlet version (for all components) */ - public static final String version = "2.0b3 async"; + public static final String version = "2.0b4 async"; /** servlet error codes */ public static enum Error {