Java – split image into parts

I know there are many topics about this, but none really suits me

The image should be saveable I tried bufferedimage, which lacks a useful constructor

It doesn't have to be Java A simple tool that can do this can also do the job Note: I have to get about 567 images from it I found the "online image splitter", but none of them can segment the image into more than 32 parts

Solution

final BufferedImage source = ImageIO.read(new File("<sourceDir>/1fby-6t-555d.png"));
final BufferedImage source = ImageIO.read(new File("<sourceDir>/1fby-6t-555d.png"));
int idx = 0;
for (int y = 0; y < source.getHeight(); y += 32) {
    ImageIO.write(source.getSubimage(0,y,32,32),"png",new File("<sourceDir>/1fby-6t-555d_" + idx++ + ".png"));
}

The above is the Java collected and sorted out by the programming house for you - splitting images into parts. I hope this article can help you solve the program development problems encountered by Java - splitting images into parts.

If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>