List of utility methods to do Image Cut
void | cutImage(String src, String dest, int x, int y, int w, int h) cut Image Iterator iterator = ImageIO.getImageReadersByFormatName("jpg"); ImageReader reader = (ImageReader) iterator.next(); InputStream in = new FileInputStream(src); ImageInputStream iis = ImageIO.createImageInputStream(in); reader.setInput(iis, true); ImageReadParam param = reader.getDefaultReadParam(); Rectangle rect = new Rectangle(x, y, w, h); param.setSourceRegion(rect); ... |
boolean | cutImage(String src, String dest, int x, int y, int w, int h) cut Image try { Iterator iterator = ImageIO.getImageReadersByFormatName("jpg"); ImageReader reader = (ImageReader) iterator.next(); InputStream in = new FileInputStream(src); ImageInputStream iis = ImageIO.createImageInputStream(in); reader.setInput(iis, true); ImageReadParam param = reader.getDefaultReadParam(); x = (x > 0 ? x : 0); ... |