Reputation: 2177
I have picture which i want to crop, but i want to cut off onlu 100 px from the left of the picture.
I'm using thumbnailator.
Do you know maybe, how to do it?
Tanks
Upvotes: 3
Views: 3129
Reputation: 363
It's easy. Just do this:
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Thumbnails.of(inputStream).crop(Positions.CENTER_LEFT).size(100,100).keepAspectRatio(true).toOutputStream(outputStream);
byte picture[] = outputStream.toByteArray();
Upvotes: 4