Here you can find the source of cropImage(BufferedImage image, int width, int height)
Parameter | Description |
---|---|
image | The image to crop |
width | width in pixels |
height | height in pixels |
private static BufferedImage cropImage(BufferedImage image, int width, int height)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; public class Main { /**// www .ja va2 s . c o m * Crops the image to the given size starting at (0,0) * * @param image * The image to crop * @param width * width in pixels * @param height * height in pixels */ private static BufferedImage cropImage(BufferedImage image, int width, int height) { if (image.getWidth() == width && image.getHeight() == height) { return image; } return image.getSubimage(0, 0, width, height); } }