# HG changeset patch # User robcast # Date 1299710502 -3600 # Node ID ace973a106b56fb654212f08ddc6f7ac8e2ad3eb # Parent 83e747b2a98f5566f332b170d41a9f0ae0798348 fixed linux version of image ops. diff -r 83e747b2a98f -r ace973a106b5 servlet/src/digilib/image/ImageLoaderDocuImage.java --- a/servlet/src/digilib/image/ImageLoaderDocuImage.java Wed Mar 09 20:07:18 2011 +0100 +++ b/servlet/src/digilib/image/ImageLoaderDocuImage.java Wed Mar 09 23:41:42 2011 +0100 @@ -82,8 +82,9 @@ protected static boolean needsInvertRgba = false; /* RescaleOp for contrast/brightness operation */ protected static boolean needsRescaleRgba = false; - /* lookup tables for false-color */ + /* lookup table for false-color */ protected static LookupTable mapBgrByteTable; + protected static boolean needsMapBgr = false; static { /* @@ -129,11 +130,12 @@ invertByte, invertByte, orderedByte, invertByte}); needsInvertRgba = true; needsRescaleRgba = true; + needsMapBgr = true; } else { invertRgbaByteTable = invertSingleByteTable; } // this hopefully works for all - mapBgrByteTable = new ByteLookupTable(0, new byte[][] { + mapBgrByteTable = new ByteLookupTable(0, new byte[][] { mapR, mapG, mapB}); } @@ -313,6 +315,13 @@ logger.debug("loading.."); img = reader.read(0, readParam); logger.debug("loaded"); + /* downconversion of highcolor images seems not to work + if (img.getColorModel().getComponentSize(0) > 8) { + logger.debug("converting to 8bit"); + BufferedImage dest = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_3BYTE_BGR); + dest.createGraphics().drawImage(img, null, 0, 0); + img = dest; + } */ } catch (IOException e) { throw new FileOpException("Unable to load File!"); } finally { @@ -601,7 +610,7 @@ invtbl = invertSingleByteTable; } LookupOp op = new LookupOp(invtbl, renderHint); - logger.debug("colop: image=" + img + " colormodel=" + cm); + logger.debug("colop: image=" + img); op.filter(img, img); } else if (colop == ColorOp.MAP_GRAY_BGR) { /* @@ -612,8 +621,13 @@ ColorConvertOp grayOp = new ColorConvertOp( ColorSpace.getInstance(ColorSpace.CS_GRAY), renderHint); // create new 3-channel image + int destType = BufferedImage.TYPE_INT_RGB; + if (needsMapBgr) { + // special case for broken Java2Ds + destType = BufferedImage.TYPE_3BYTE_BGR; + } BufferedImage dest = new BufferedImage(img.getWidth(), - img.getHeight(), BufferedImage.TYPE_INT_RGB); + img.getHeight(), destType); img = grayOp.filter(img, dest); logger.debug("map_gray: image=" + img); // convert to false color diff -r 83e747b2a98f -r ace973a106b5 servlet/src/digilib/servlet/Scaler.java --- a/servlet/src/digilib/servlet/Scaler.java Wed Mar 09 20:07:18 2011 +0100 +++ b/servlet/src/digilib/servlet/Scaler.java Wed Mar 09 23:41:42 2011 +0100 @@ -31,7 +31,7 @@ private static final long serialVersionUID = 5289386646192471549L; /** digilib servlet version (for all components) */ - public static final String version = "1.9.1a23"; + public static final String version = "1.9.1a24"; /** servlet error codes */ public static enum Error {UNKNOWN, AUTH, FILE, IMAGE};