Dmitri Snytkine
Dmitri Snytkine

Reputation: 1126

How to shave off image in Java?

This is what I need to do. I need to create square thumbnails from a standard photo. The photos are usually portrain layout, so I need to shave off the bottom part of the photo so that the height is equals to the width.

If the image is landscape layout then I need to shave off equal number of pixels from left and right to make it square.

Any ideas how to do this?

My image is BufferedImage object already.

Upvotes: 1

Views: 136

Answers (1)

emboss
emboss

Reputation: 39650

You can use getSubimage to retrieve a cropped version of the original image.

Upvotes: 1

Related Questions