Converting BMP to JPEG in Windows.

Hello everybody. I have a program that generate hundreds of files in BMP, only that it takes up too much space. So I need to convert them to JPEG or PNG pair (which takes up less space, in this case quality is not as important). I've searched the forum, already looked on google but never think anything that helps me. Anyone have any idea? Thanks
Use a library. Here is how I would do such a conversion using CImg, but there are a large number of libraries just as easy to use.

#include <CImg.h>
#include <iostream>
using namespace cimg_library;

int main()
  CImg<float> image("input.bmp");"output.png");

Use a library.

Why use a library when Microsoft provides what you need already ????

Use gdiplus directly, you need few lines of code for this simple conversion, examples in MSDN. I used myself ATL CImage class, which only requires 2 lines of code, but you could use gdiplus directly if you can't use ATL in your project.
Why use a library when Microsoft provides what you need already ????

They provide you with a library. The alternative - not using a library - involves writing code yourself to get pixel values of each pixel in the image from the png file, and writing more code to create a new jpg file from those pixel values. This is a lot of work.
For this particular task (conversion from bmp to jpg) only involves loading the image and saving in another format (it is supposed to not change resolution or other tasks)

Just use Bitmap class to load the bmp file and then use Image.Save() method to save to a new file. GdiPlus must be initialized before using these classes.

Using only Microsoft tools only few lines of code is required.
Topic archived. No new replies allowed.