JPEG到JFIF的转换(JPEG to JFIF conversion)
我需要将jpeg图像转换为jfif格式,这是因为我需要发送彩信数据。 任何人都可以告诉我如何使用java转换它。
I need to convert jpeg image to jfif format this is because i need to send MMS data. Can any one tell me how do convert it using 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()); }说实话,我不认为这会奏效。 也许你可以尝试第三方插件(如果存在)。
Have you tried ImageIO? I really dont know if it will work and I can't test it now (because I'm not in my home) but you can get ImageIO image formats using:
String[] formatNames = ImageIO.getReaderFormatNames();As I said, I cant test this code, but you can try:
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()); }To be honest, I dont think this will work. Maybe you can try a 3rd party plugin (if exists).
更多推荐
发布评论