Java BufferedImage Crop crop(BufferedImage original, int newSize)

Here you can find the source of crop(BufferedImage original, int newSize)

Description

crop

License

Open Source License

Declaration

public static BufferedImage crop(BufferedImage original, int newSize) 

Method Source Code

//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;
    }
}

Related

  1. adjustRectToFitImage(BufferedImage image, Rectangle cropRect)
  2. autoCrop(BufferedImage source)
  3. autoCrop(BufferedImage source, double tolerance)
  4. crop(BufferedImage image, Rectangle clip)
  5. crop(BufferedImage input, int x, int y, int width, int height)
  6. crop(BufferedImage source, File to, int x1, int y1, int x2, int y2)
  7. crop(BufferedImage source, int startX, int startY, int endX, int endY)
  8. crop(BufferedImage src, int width, int height)
  9. crop(BufferedImage src, int x, int y, int width, int height)