Here you can find the source of crop(BufferedImage original, int newSize)
public static BufferedImage crop(BufferedImage original, int newSize)
//package com.java2s; //License from project: Open Source License import java.awt.*; import java.awt.image.BufferedImage; public class Main { public static BufferedImage crop(BufferedImage original, int newSize) { BufferedImage image = new BufferedImage(newSize, newSize, BufferedImage.TYPE_INT_ARGB); Graphics2D g = image.createGraphics(); g.drawImage(original, 0, 0, null); g.dispose();/*from www. j a v a 2 s . c o m*/ return image; } }