如何将图像分割成多个较小的图像 [英] How to split an image into multiple smaller images

查看:197
本文介绍了如何将图像分割成多个较小的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将Image对象( java.awt.Image )拆分为较小的图像?

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

For例如,将64 * 64px图像分割成16张16 * 16px图像的精灵表。

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

推荐答案

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

使用如下函数:


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

您正在使用裁剪图像过滤器创建图像。

You are creating an image using the 'crop image filter').

然后它应该只是迭代原始图像抓住你想要的不同方块。

Then it should just be a matter of iterating through the original image grabbing the different squares you want.

这篇关于如何将图像分割成多个较小的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆