protected RenderedImage doFilter(BufferedImage pImage, ServletRequest pRequest, ImageServletResponse pResponse) { // Filter Image img = ImageUtil.filter(pImage, imageFilter); // Create BufferedImage & return return ImageUtil.toBuffered(img, BufferedImage.TYPE_INT_RGB); // TODO: This is ok for JPEG only... } }
/** * Converts an image to grayscale. * * @see GrayFilter * @see RGBImageFilter * * @param pOriginal the image to convert. * @return a new Image, containing the gray image data. */ public static Image grayscale(Image pOriginal) { // Create filter RGBImageFilter filter = new GrayFilter(); // Convert to gray return filter(pOriginal, filter); }
/** * Changes the contrast of the image * * @param pOriginal the {@code Image} to change * @param pAmount the amount of contrast in the range [-1.0..1.0]. * * @return an {@code Image}, containing the contrasted image. */ public static Image contrast(Image pOriginal, float pAmount) { // No change, return original if (pAmount == 0f) { return pOriginal; } // Create filter RGBImageFilter filter = new BrightnessContrastFilter(0f, pAmount); // Return contrast adjusted image return filter(pOriginal, filter); }
/** * Changes the brightness of the original image. * * @param pOriginal the {@code Image} to change * @param pAmount the amount of brightness in the range [-2.0..2.0]. * * @return an {@code Image} */ public static Image brightness(Image pOriginal, float pAmount) { // No change, return original if (pAmount == 0f) { return pOriginal; } // Create filter RGBImageFilter filter = new BrightnessContrastFilter(pAmount, 0f); // Return brightness adjusted image return filter(pOriginal, filter); }
/** * Converts an image to grayscale. * * @see GrayFilter * @see RGBImageFilter * * @param pOriginal the image to convert. * @return a new Image, containing the gray image data. */ public static Image grayscale(Image pOriginal) { // Create filter RGBImageFilter filter = new GrayFilter(); // Convert to gray return filter(pOriginal, filter); }
/** * Converts an image to grayscale. * * @see GrayFilter * @see RGBImageFilter * * @param pOriginal the image to convert. * @return a new Image, containing the gray image data. */ public static Image grayscale(Image pOriginal) { // Create filter RGBImageFilter filter = new GrayFilter(); // Convert to gray return filter(pOriginal, filter); }
/** * Changes the contrast of the image * * @param pOriginal the {@code Image} to change * @param pAmmount the ammount of contrast in the range [-1.0..1.0]. * * @return an {@code Image}, containing the contrasted image. */ public static Image contrast(Image pOriginal, float pAmmount) { // No change, return original if (pAmmount == 0f) { return pOriginal; } // Create filter RGBImageFilter filter = new BrightnessContrastFilter(0f, pAmmount); // Return contrast adjusted image return filter(pOriginal, filter); }
/** * Changes the contrast of the image * * @param pOriginal the {@code Image} to change * @param pAmount the amount of contrast in the range [-1.0..1.0]. * * @return an {@code Image}, containing the contrasted image. */ public static Image contrast(Image pOriginal, float pAmount) { // No change, return original if (pAmount == 0f) { return pOriginal; } // Create filter RGBImageFilter filter = new BrightnessContrastFilter(0f, pAmount); // Return contrast adjusted image return filter(pOriginal, filter); }
/** * Changes the brightness of the original image. * * @param pOriginal the {@code Image} to change * @param pAmount the amount of brightness in the range [-2.0..2.0]. * * @return an {@code Image} */ public static Image brightness(Image pOriginal, float pAmount) { // No change, return original if (pAmount == 0f) { return pOriginal; } // Create filter RGBImageFilter filter = new BrightnessContrastFilter(pAmount, 0f); // Return brightness adjusted image return filter(pOriginal, filter); }
/** * Changes the brightness of the original image. * * @param pOriginal the {@code Image} to change * @param pAmmount the ammount of brightness in the range [-2.0..2.0]. * * @return an {@code Image} */ public static Image brightness(Image pOriginal, float pAmmount) { // No change, return original if (pAmmount == 0f) { return pOriginal; } // Create filter RGBImageFilter filter = new BrightnessContrastFilter(pAmmount, 0f); // Return brightness adjusted image return filter(pOriginal, filter); }