JPEG到JFIF的转换

时间:2011-01-10 10:31:24

标签: java image-processing jpeg

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

1 个答案:

答案 0 :(得分:-2)

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

说实话,我不认为这会奏效。也许你可以试试第三方插件(如果存在)。