我需要将jpeg图像转换为jfif格式,这是因为我需要发送彩信数据。谁能告诉我怎么用java来转换它?
发布于 2011-01-10 19:10:11
你试过ImageIO吗?我真的不知道它是否可以工作,我现在也不能测试它(因为我不在家里),但你可以使用以下命令获得ImageIO图像格式:
String[] formatNames = ImageIO.getReaderFormatNames();正如我所说的,我不能测试这段代码,但是你可以试试:
try {
File input = new File("srcImage.jpeg");
BufferedImage image = ImageIO.read(input);
File output = new File("dstImage.jfif");
ImageIO.write(image, "jfif", output);
System.out.println("Your image has been converted successfully");
} catch(Excpetion e){
System.out.println("Error:"+e.getMessage());
}老实说,我认为这行不通。也许你可以试试第三方插件(如果存在)。
https://stackoverflow.com/questions/4645809
复制相似问题