您的位置:首页 > 其它

使用Jimi处理图像

2009-12-10 10:58 183 查看
Jimi是Java的图像管理类库,主要提供的是Image IO的功能,其前身是Activated Intelligence。Jimi支持包括GIF, JPEG, TIFF, PNG, PICT, Photoshop, BMP, Targa, ICO, CUR, Sunraster, XBM, XPM, and PCX在内的各种格式图像。

官方地址:http://java.sun.com/products/jimi/

最简单的方式:

package test;

import java.awt.Image;

import com.sun.jimi.core.Jimi;
import com.sun.jimi.core.JimiException;

public class ImageHelper {

/**
* 转换图片格式,基于jimi.jar
* @param oldFile
* @param newFile
* @return
*/
public static boolean convertImageFormat(String oldFile,String newFile)
{
boolean isok = true;
try {
Image img=Jimi.getImage(oldFile);
Jimi.putImage(img,newFile);
} catch (JimiException e) {
isok = false;
e.printStackTrace();
}
return isok;
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: