@Override @Nonnull public String toString() { return String.format("ConvertColorProfileOp(%s, %s)", ImageUtils.getICCProfileName(iccProfile), renderingIntent); } }
/******************************************************************************* * * ******************************************************************************/ public static String getICCProfileName (RenderedImage image) { ICC_Profile iccProfile = ImageUtils.getICCProfile(image); if (iccProfile != null) { return ImageUtils.getICCProfileName(iccProfile); } else { return null; } }
/******************************************************************************* * Generate a square gaussian blur kernel to be used with the JAI * convolve operation. The kernel size is calculated automatically based * on the standard deviation parameter, so as to comprise a +/- 3*sigma * bell around the center * * @param sigma standard deviation of gaussian bell * @return gaussian blur kernel ******************************************************************************/ public static Kernel gaussianBlurKernel(double sigma) { int size = 0; if (sigma < 0.5) size = 3; else if (sigma >= 0.5 && sigma < (5.0/6.0)) size = 5; else if (sigma >= (5.0/6.0) && sigma < (7.0/6.0)) size = 7; else if (sigma >= (7.0/6.0) && sigma < 1.5) size = 9; else if (sigma >= 1.5 && sigma < (11.0/6.0)) size = 11; else if (sigma >= (11.0/6.0) && sigma < (13.0/6.0)) size = 13; else if (sigma >= (13.0/6.0)) size = 15; Kernel result = gaussianBlurKernel(sigma, size); return result; }
@Override @Nonnull public String toString() { return String.format("AssignColorProfileOp(%s)", ImageUtils.getICCProfileName(iccProfile)); } }
log.debug("convertColorProfile({})", ImageUtils.getICCProfileName(targetProfile)); Java2DUtils.logImage(log, ">>>> source bufferedImage", bufferedImage); final ICC_Profile sourceProfile = ImageUtils.getICCProfile(bufferedImage); final String sourceProfileName = ImageUtils.getICCProfileName(sourceProfile); log.debug(">>>> Converting profile from {} to {}", sourceProfileName, ImageUtils.getICCProfileName(targetProfile));
/******************************************************************************* * * ******************************************************************************/ private static String toString (ICC_ColorSpace colorSpace) { StringBuffer buffer = new StringBuffer(""); buffer.append(colorSpace.getClass().getName()); buffer.append("[type: "); buffer.append(colorSpace.getType()); buffer.append(", profile name: "); buffer.append(ImageUtils.getICCProfileName(colorSpace.getProfile())); buffer.append("]"); return buffer.toString(); }
@Nonnull @Override protected BufferedImage execute (final @Nonnull AssignColorProfileOp operation, final @Nonnull EditableImage image, final @Nonnull BufferedImage bufferedImage) { final ICC_Profile targetProfile = operation.getIccProfile(); log.trace("assignColorProfile({})", ImageUtils.getICCProfileName(targetProfile)); Java2DUtils.logImage(log, ">>>> source bufferedImage", bufferedImage); final ColorSpace colorSpace = new ICC_ColorSpace(targetProfile); final ColorModel colorModel = new ComponentColorModel(colorSpace, false, false, ColorModel.OPAQUE, bufferedImage.getRaster().getDataBuffer().getDataType()); final BufferedImage result = new BufferedImage(colorModel, bufferedImage.getRaster(), false, Java2DUtils.getProperties(bufferedImage)); Java2DUtils.logImage(log, ">>>> assignColorProfile() returning ", bufferedImage); return result; } }
/******************************************************************************* * * @inheritDoc * ******************************************************************************/ protected PlanarImage execute (ConvertColorProfileOp operation, final EditableImage image, PlanarImage planarImage) { ICC_Profile iccProfile = operation.getICCProfile(); logger.fine("convertColorProfile(" + ImageUtils.getICCProfileName(iccProfile) + ") - " + planarImage.getSampleModel()); planarImage = ColorConvertDescriptor.create(planarImage, JAIUtils.getColorModel(planarImage, iccProfile), null); // FIXME: RenderingHints JAIUtils.logImage(logger, ">>>> convertColorProfile() returning", planarImage); return planarImage; } }
String sourceProfileName = ImageUtils.getICCProfileName(colorSpace.getProfile());