Java BufferedImage Crop cropAndScaleImage(BufferedImage image, int cropX, int cropY, int cropW, int cropH, int scaleW, int scaleH)

Here you can find the source of cropAndScaleImage(BufferedImage image, int cropX, int cropY, int cropW, int cropH, int scaleW, int scaleH)

Description

crop And Scale Image

License

Open Source License

Declaration

public static BufferedImage cropAndScaleImage(BufferedImage image,
            int cropX, int cropY, int cropW, int cropH, int scaleW,
            int scaleH) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

public class Main {
    public static BufferedImage cropAndScaleImage(BufferedImage image,
            int cropX, int cropY, int cropW, int cropH, int scaleW,
            int scaleH) {
        BufferedImage bimage = new BufferedImage(scaleW, scaleH,
                image.getType());// www.ja  v  a 2  s  . c  om
        Graphics2D bGr = bimage.createGraphics();
        bGr.drawImage(image, 0, 0, scaleW - 1, scaleH - 1, cropX, cropY,
                cropX + cropW - 1, cropY + cropH - 1, null);
        bGr.dispose();
        return bimage;
    }
}

Related

  1. crop(BufferedImage src, int width, int height)
  2. crop(BufferedImage src, int x, int y, int width, int height)
  3. crop(BufferedImage src, Rectangle rect)
  4. crop(final Raster src, final long tx, final long ty, final long minTx, final long maxTy, final int tilesize)
  5. crop4Square(BufferedImage source, File to, int size)
  6. cropBottomTransparent(BufferedImage img)
  7. cropBoundingBox(Rectangle r, int width, int height)
  8. cropImage(BufferedImage image, int cropWidth, int cropHeight)
  9. cropImage(BufferedImage image, int fromX, int fromY, int width, int height)