Solved

Source code for converting jpg to bmp

Posted on 2000-02-17
6
308 Views
Last Modified: 2013-11-19
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
Comment
Question by:lmh110697
6 Comments
 
LVL 2

Expert Comment

by:coopa
ID: 2539646
Have a look here for the Jpeg source...

ftp://ftp.uu.net/graphics/jpeg
0
 

Expert Comment

by:TSMITH
ID: 2557243
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
 
LVL 6

Expert Comment

by:edey
ID: 2570282
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Expert Comment

by:sunsetyang
ID: 2607700
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
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 2696308
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
 

Accepted Solution

by:
aegana earned 50 total points
ID: 2709767
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In this Micro Tutorial viewers will learn how to remove an unwanted object using Photoshop’s feature known as content-aware fill.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now