gpt4 book ai didi

java - JPEG 到 JFIF 转换

转载 作者:行者123 更新时间:2023-12-01 06:24:53 25 4
gpt4 key购买 nike

我需要将 jpeg 图像转换为 jfif 格式,这是因为我需要发送彩信数据。谁能告诉我如何使用java转换它。

最佳答案

你尝试过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());
}

说实话,我认为这行不通。也许您可以尝试第 3 方插件(如果存在)。

关于java - JPEG 到 JFIF 转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4645809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com