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

Posted on 2008-10-02
Last Modified: 2012-05-05

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;
     image1 = FreeImage_Load(FIF_BMP, bmp_filepath, 0);
     image2 = FreeImage_ConvertTo24Bits(image1);
     if (!FreeImage_Save(FIF_JPEG, image2, jpg_filepath, JPEG_QUALITYGOOD))
        return false;
     return true;

Open in new window

Question by:Valty
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
LVL 12

Accepted Solution

trinitrotoluene earned 300 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

Assisted Solution

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

Author Comment

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

Author Comment

ID: 22753497
I finally used FreeImage as dyn lib

Author Closing Comment

ID: 31502323

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

726 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