converting bmp to jpg in java

12,873

Yes you will. Actually regardless of the way to convert a BMP (lossless) to JPG (lossy) you always lose quality. You can limit the damage if you set the JPG quality to 100% (which kind of defeats the purpose in my opinion).

Use this tutorial to fix it.

Share:
12,873
Jeel Shah
Author by

Jeel Shah

The author of The Clockworks of Wall Street: Currently a first year student at Wilfrid Laurier University who enjoys all topics including Physics, Math, Computer Science and Philosophy.

Updated on June 05, 2022

Comments

  • Jeel Shah
    Jeel Shah almost 2 years

    How do you convert bmp to jpg in Java? I know how to use the ImageIO way but is there a much faster or better way of doing it?

    This is the ImageIO way of doing that I found on the web.

    `//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);
    

    If I use this way will I lose quality?

    Thanks