java中bmp到jpg的转换
如何在Java中将bmp转换为jpg?我知道如何使用java中bmp到jpg的转换,java,jpeg,bmp,Java,Jpeg,Bmp,如何在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 t
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%,你可以限制伤害(我认为这与目的背道而驰)
用这个来修复它。是的,你会的。实际上,无论以何种方式将BMP(无损)转换为JPG(有损),质量总是会下降。如果你将JPG的质量设置为100%,你可以限制伤害(我认为这与目的背道而驰)
用这个来修复它。我建议使用PNG而不是JPG。你仍然会得到比BMP小得多的图像,但不会损失图像质量。我建议使用PNG而不是JPG。您仍然可以获得比BMP小得多的图像,但不会损失图像质量。