在java中将bmp转换为jpg

你如何在Java中将bmp转换为jpg? 我知道如何使用ImageIO方式但是有更快或更好的方法吗?

这是我在网上找到的ImageIO方式。

 `//Create file for the source File input = new File("c:/temp/image.bmp"); //Read the file to a BufferedImage BufferedImage image = ImageIO.read(input);` //Create a file for the output File output = new File("c:/temp/image.jpg"); //Write the image to the destination as a JPG ImageIO.write(image, "jpg", output); 

如果我用这种方式,我会失去质量吗?

谢谢

是的你将会。 实际上无论将BMP(无损)转换为JPG(有损)的方式如何,您总是会失去质量。 如果将JPG质量设置为100%(在我看来哪种方式违背了目的),您可以限制损坏。

使用本教程修复它。