Convert BMP to JPG using Java
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Convert BMP to JPG using Java

  1. #1
    Join Date
    Aug 2011
    Posts
    1

    Convert BMP to JPG using Java

    HI,

    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).

    Thanks

  2. #2
    Join Date
    Mar 2010
    Location
    Melbourne Australia
    Posts
    454

    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

    http://www.jmagick.org/index.html;js...7E995E3621DA97

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

  3. #3
    Join Date
    Jun 1999
    Location
    SW Missouri
    Posts
    3,429

    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?
    Norm

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

This is a CodeGuru survey question.


Featured


HTML5 Development Center