Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Help about JCrop

Al Lestaire Acasio
6 years ago Oct 06, 2015 6:17am
Nengah Dwijaya
6 years ago Oct 17, 2015 10:19am

Hi Al,

JCrop is not return with the image selected, JCrop is only return with the posisition of the image selected.
you can use another tools to crop the file and save it.

I user ImgScalr library :

BufferedImage img = ImageIO.read(new File(filenameSelected));
BufferedImage imgRs = Scalr.crop(img, selectionLast.getX(), selectionLast.getY(), selectionLast.getWidth(), selectionLast.getHeight(),
Scalr.OP_ANTIALIAS);

ByteArrayOutputStream imagebuffer = new ByteArrayOutputStream();
ImageIO.write(imgRs, "png", imagebuffer);

inputStream = new ByteArrayInputStream(
imagebuffer.toByteArray());

 

Al Lestaire Acasio
6 years ago Oct 19, 2015 3:13am