Compress BMP.

Hello everybody.
I'm having a little problem.

My program creates BMP files, hundreds or thousands of them and how those files are huge I need to compress them somehow. The first thing that came to mind would turn them into JPEG files.

I even found a tutorial in http://www.andrewewhite.net/wordpress/2008/09/02/very-simple-jpeg-writer-in-c-c/ but I can not understand and adapt the solution to my problem.

Anybody have some algorithm to compress the BMP or an example of how to convert them to JPEG using C language, if possible without the use of SDL or the like?

Thank you.
Just like read/write various image file formats, you also have various compression libraries. Some are Open Source, some are not.

Unless you want to create your own version which means the receiving parties also need your program to de-compress it, I would recommend surf Google for some Open Source compression libraries ready to use. I always think Winzip is Open Source but obviously it is not. But somehow almost any Windows programs I uses can understand winzip files so strange isn't it ?

I believe before Winzip there is Pkzip by PKWare which revolutionize the computer world during that time. http://en.wikipedia.org/wiki/PKZIP
You could use GdiPlus to save them as JPEG, PNG or another format. No 3rd party tools needed.
If you could use ATL::CImage class will be very few lines of code.
Just use Shell apis.
1 line of code..
Just use Shell apis.
What? I am not aware of any shell that has built-in conversion from bmp to jpeg, I don't see why I a shell should have such a function, nor do I see how that's going to help him doing this on runtime (which he is probably trying to do).
>What? I am not aware of any shell that has built-in conversion from bmp to jpeg, I don't see >why I a shell should have such a function, nor do I see how that's going to help him doing >this on runtime (which he is probably trying to do).

It's even a Win32 FAQ
(news://nntp.aioe.org/comp.os.ms-windows.programmer.win32 or
http://tinyurl.com/cmhb5g by Google Groups)
That link doesn't lead anywhere.
1
2
3
4
5
#include <atlimage.h>
ATL::CImage img;
img.Load(_T("img.bmp"));
img.Save(_T("img.png"),  Gdiplus::ImageFormatPNG );
img.Save(_T("img.jpg"),  Gdiplus::ImageFormatJPEG );



Very simple and no 3rd party libraries needed, only built-in windows libraries.

Very simple and no 3rd party libraries needed, only built-in windows libraries.


There is a huge contradiction between what comes before and what comes after the comma.
First, I'm the author of andrewewhite.net so if you have specific questions, let me know. Second, have you looked into ImageMagic (http://www.imagemagick.org/script/index.php)?
> That link doesn't lead anywhere.

Of course it works, it's a Usenet link (for 30 years !!)
or by Google Groups
converting BMP<=> JPEG has been given hundreds of times ...
Topic archived. No new replies allowed.