Sign in to follow this  
Laval B

Saving images using JPEG file format

Recommended Posts

Laval B    12387
Hello everyone.

I'm implementing in our engine the possibility of taking screen captures. This is very easy to get the raw data from the frame buffer. The problem is, i would like to be able to save the image in JPEG format because of the compression and this is a better file format for exchanges.

I have worked with lib JPEG before. This is a good library and it is very easy to used. However, it is a bit big. NVIDIA has a tool for opening jpeg that is very small (it's only a .h and a .cpp) called JPEGLoader.h/cpp. Unfortunatly, i wasn't able to find the writter conterpart.

Does anyone know about a small (even restricted) C++ JPEG compressor ?

Thanks

Share this post


Link to post
Share on other sites
mhagain    13430
If you're coding on Windows you can use GDI+ to save a JPEG. If you're using D3D then there are some nice functions available to save surfaces in multiple image formats. Otherwise I honestly wouldn't worry about executable size; there's a "bloatware" myth that bigger executables are somehow slower, and it's actually just that - a myth.

Share this post


Link to post
Share on other sites
_Unicron_    438
I use [url="http://openil.sourceforge.net/"]DevIL[/url] in my projects. It provides a nice interface for output to a variety of formats.

Share this post


Link to post
Share on other sites
Laval B    12387
Thank you guys for your replies.

I work on both Windows and MAC OSX so platform specific APIs such as D3D and GDI+ are, unfortunatly, a luxury i can't afford. I'm not worried about the size of the executable file, it is more a matter of keeping the code base as lean and mean as possible.

Devil looks like an interesting lib we could use for the tool artists will use.

For writting jpeg, i guess i'll use libjpeg. Maybe i'll try to write and encoder if i have the time.


Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this