Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

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.
:>)
0
lmh110697
Asked:
lmh110697
1 Solution
 
coopaCommented:
Have a look here for the Jpeg source...

ftp://ftp.uu.net/graphics/jpeg
0
 
TSMITHCommented:
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...

http://www.smalleranimals.com/jpegfile.htm

http://www.codeguru.com/bitmap/index.shtml

0
 
edeyCommented:
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)


GL
Mike



GL
Mike
0
Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

 
sunsetyangCommented:
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:
http://www.cubic.org/source/archive/fileform/graphic/
to see the coding method.
0
 
ShaunWildeCommented:
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
0
 
aeganaCommented:
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.

http://www.efg2.com/lab/Graphics/BMPJPG.htm
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now