Save screen as an image file

Hi,

im currently trying to do a save screen as image file from my current OpenGL window. So its like when i press a button, the program save the current image in the OpenGL window as an image file. I currently able to do it manually, and save it as a TGA image. But I think other kind of file such as JPEG will be a hell of an algorithm to start from scratch. Is there any library so i can save the image to other type of image file such as JPEG?

Thanks in advance

There is JasPer and libjpeg.

And freeimage for a bunch of formats.

DevIL aka OpenIL