Source code for converting jpg to bmp

I'm looking for source code for
converting from jpg & gif image file to black & white bmp file.

(Windows NT & jdk 1.1.8, or c++)

I need your help.
Thanks in advance.
Who is Participating?
aeganaConnect With a Mentor Commented:
Try this page. There is a Delphi implementation of a program that converts images from BMP to JPG (or from JPG to BMP). It also have the source code.
Have a look here for the Jpeg source...
This is where I get my routines from. I'm in the process of classing my own format load/save, but jpeg is out of my league at present ;) anyhow, hope these help...

The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

If you know how to load a jpeg/gif, the easiest method it to blt it to a bmp and save the result :)

As far as converting it to b/w (if it isn't already) you have a couple of options:

1)Let windows do it by creating the bmp with a b/w palette
2)do your own conversion, perhaps something like this (for a 24bit bmp)
  result = sqrt(red*red+green*green+blue*blue)*(255/441)


You can see the source of Delphi 4's jpeg library if you have Delphi.In Delphi3 it was on the cdrom and written in C.You can check.GIF uses LZW coding,You can visit:
to see the coding method.
here is how I would do it:

use OleLoadPicture to load the image which can then be rendered using the IPicture interface and the Render method.

Because you can render it to any dc including a memory DC you can then save the image to a BMP

This technique will also work for .gif as well
All Courses

From novice to tech pro — start learning today.