How to split an image into several smaller images

How can I split an Image object ( java.awt.Image ) into smaller images?

For example, splitting a 64 * 64px image into a sprite sheet of 16 16 * 16px images.

+6
source share
1 answer

See: http://rameshjavablog.blogspot.com/2012/04/sub-image-from-image-using-java.html

Using a function such as:

image = createImage(new FilteredImageSource(image.getSource(),new CropImageFilter(13, 13, 143, 163)));

You create an image using the "crop image filter").

Then it should be just a repetition of the original image, capturing the various squares that you want.

+4
source

Source: https://habr.com/ru/post/945447/


All Articles