?
Solved

C++ / Need to convert BMP to JPG with a static library

Posted on 2008-10-02
5
Medium Priority
?
1,828 Views
Last Modified: 2012-05-05
Hello,

I currently use FreeImage to convert a BMP file to a JPG file, but I need to use a static library to deploy my program, and it's impossible to compile FreeImage as static library with Dev-Cpp (minWG).

I know that a libjpeg exists, but I don't know if it possible to do that I want.

My actual code is bellow.

If anybody have a solution to my problem...

Thanks in advance !
bool bmp_to_jpg(char *bmp_filepath, char *jpg_filepath)
{
     FIBITMAP * image1, * image2;
     FreeImage_Initialise(false);
 
     image1 = FreeImage_Load(FIF_BMP, bmp_filepath, 0);
     image2 = FreeImage_ConvertTo24Bits(image1);
				
     if (!FreeImage_Save(FIF_JPEG, image2, jpg_filepath, JPEG_QUALITYGOOD))
        return false;
 
     FreeImage_Unload(image1);
     FreeImage_Unload(image2);
     FreeImage_DeInitialise();
     return true;
}

Open in new window

0
Comment
Question by:Valty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 12

Accepted Solution

by:
trinitrotoluene earned 900 total points
ID: 22626035
You can search for open source code which will read a bmp. Similarly get code which will encode to jpg

Here are few links which may help

http://www.codeproject.com/KB/graphics/tonyjpeglib.aspx

http://www.voicenet.com/~richgel/

http://www.faqs.org/qa/qa-7869.html

http://www.gamedev.net/reference/articles/article1966.asp
0
 
LVL 9

Assisted Solution

by:JohnGaby
JohnGaby earned 600 total points
ID: 22626104
CxImage is an open source library which (I beleieve) you can compile as a static library:

http://www.codeproject.com/KB/graphics/cximage.aspx
0
 

Author Comment

by:Valty
ID: 22635705
Thanks guys, but I really need an example for using one of these libs. I'm not very comfortable with the image manipulation...
0
 

Author Comment

by:Valty
ID: 22753497
I finally used FreeImage as dyn lib
0
 

Author Closing Comment

by:Valty
ID: 31502323
Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

765 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