Java BufferedImage Crop cropImage(BufferedImage image, int lc, int rc, int tc, int bc)

Here you can find the source of cropImage(BufferedImage image, int lc, int rc, int tc, int bc)

Description

crop Image

License

Open Source License

Declaration

public static BufferedImage cropImage(BufferedImage image, int lc, int rc, int tc, int bc) 

Method Source Code

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

import java.awt.Graphics;

import java.awt.image.BufferedImage;

public class Main {
    public static BufferedImage cropImage(BufferedImage image, int lc, int rc, int tc, int bc) {
        BufferedImage dest = new BufferedImage(image.getWidth() - (lc + rc), image.getHeight() - (tc + bc),
                BufferedImage.TYPE_BYTE_GRAY);
        Graphics g = dest.getGraphics();
        g.drawImage(image, 0, 0, image.getWidth() - (lc + rc), image.getHeight() - (tc + bc), lc, tc,
                image.getWidth() - rc, image.getHeight() - bc, null);
        g.dispose();//from  w ww  .j  a v a 2  s  .  c  o  m
        return dest;
    }
}

Related

  1. cropAndScaleImage(BufferedImage image, int cropX, int cropY, int cropW, int cropH, int scaleW, int scaleH)
  2. cropBottomTransparent(BufferedImage img)
  3. cropBoundingBox(Rectangle r, int width, int height)
  4. cropImage(BufferedImage image, int cropWidth, int cropHeight)
  5. cropImage(BufferedImage image, int fromX, int fromY, int width, int height)
  6. cropImage(BufferedImage image, int width, int height)
  7. cropImage(BufferedImage image, int width, int height)
  8. cropImage(BufferedImage image, int x, int y, int width, int height)
  9. cropImage(BufferedImage image, int x1, int y1, int x2, int y2)