Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何将png图像转换为JPG2000格式_Java - Fatal编程技术网

Java 如何将png图像转换为JPG2000格式

Java 如何将png图像转换为JPG2000格式,java,Java,我正在使用网络摄像头库捕获个人图像passport。生成的图像是png的信息。我想创建一个临时png文件,然后将该png文件转换为JPG2000格式。如何在java中实现这一点?下面是我的示例代码n java webcam.open(); BufferedImage image = webcam.getImage(); imagePath = ""; File temppngfile = new File(imagePa

我正在使用网络摄像头库捕获个人图像passport。生成的图像是png的信息。我想创建一个临时png文件,然后将该png文件转换为JPG2000格式。如何在java中实现这一点?下面是我的示例代码n java

   webcam.open();
            BufferedImage image = webcam.getImage();
            imagePath = "";
           File temppngfile = new File(imagePath);

            ImageIO.write(image, "png", temppngfile);

你为什么不用PNG格式写你的临时PNG文件?@Berger我想把PNG文件转换成jpeg2000格式,我的主要目标是你能试试“jpeg2000”而不是“j2k”吗?还有输出是什么,你有什么错误吗?@Berger我没有任何错误。当我使用png时,文件生成成功,但当我尝试任何其他格式时,它根本不起作用