CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2011

    Convert BMP to JPG using Java


    I am trying to convert an image in BMP format to JPG format. In the course of conversion, the DPI of the image is lost (default DPI is getting applied after conversion).

    For example, If the DPI of original image (BMP format) is 300 DPI, on converting DPI of JPG is getting changed to default system DPI (i.e., 96 DPI).

    I tried converting the image using JAI and JPEG Encode, but got the same result.

    Can anyone please let me know how to convert an image from BMP format to JPG format without compromising on DPI. It is a bit URGENT.

    Sorry if there is any post relating to same earlier (which i may have skipped).


  2. #2
    Join Date
    Mar 2010
    Melbourne Australia

    Re: Convert BMP to JPG using Java

    if you want to do in manually and lets say on windows , then you need to read in the BMP file , in a uncompressed BMP the image data is stored as BGR as oppose RBG , each with 1 unsigned char ( 1 byte ) range from 0 to 255 per channel.

    you can use


    to extract the image data and then recode to JPEG just the same,

  3. #3
    Join Date
    Jun 1999
    Eastern Florida

    Re: Convert BMP to JPG using Java

    on converting DPI of JPG is getting changed to default system DPI (i.e., 96 DPI).
    How are you creating and writing the jpg file. Are there options to control the quality of the output image?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.