public synchronized Raster getTile(int tileX, int tileY) { if (tileX != 0 || tileY != 0) { throw new IllegalArgumentException(JaiI18N.getString("JPEGImageDecoder4")); } return image.getTile(0, 0); }
public static void main(String args[]) { try { ICC_Profile inProfile = ICC_Profile.getInstance("/System/Library/ColorSync/Profiles/AdobeRGB1998.icc"); ICC_Profile outProfile = ICC_Profile.getInstance("/Library/ColorSync/Profiles/CIE 1931 D50 Gamma 1.icm"); Profile cmsOutProfile = new Profile(outProfile); Profile cmsInProfile = new Profile(inProfile); BufferedImage inputImage = ImageIO.read(new File("/Stuff/Reference/small-q60-adobergb.TIF")); ShortInterleavedRaster inputRaster = (ShortInterleavedRaster) inputImage.getTile(0, 0); ColorSpace outCS = new ICC_ColorSpace(outProfile); ColorModel outCM = new ComponentColorModel(outCS, false, false, Transparency.OPAQUE, DataBuffer.TYPE_USHORT); ShortInterleavedRaster outputRaster = (ShortInterleavedRaster) outCM.createCompatibleWritableRaster(inputImage.getWidth(), inputImage.getHeight()); BufferedImage outputImage = new BufferedImage(outCM, outputRaster, false, null); Transform cmsTransform = new Transform( cmsInProfile, TYPE_RGB_16, cmsOutProfile, TYPE_RGB_16, INTENT_PERCEPTUAL, 0); cmsTransform.doTransform(inputRaster, outputRaster); ImageIO.write(outputImage, "TIF", new File("/Stuff/small-q60-CIED65.TIF")); cmsTransform.dispose(); cmsOutProfile.dispose(); cmsInProfile.dispose(); // System.out.println("Profile: " + hProfile + ", " + ); } catch (IOException e) { e.printStackTrace(); } }