JPEG questions

  1. I understand that JPEG supports RGBA formats (it even supports up to 255 components). On the other hand I have never seen a JPEG image with an alpha channel. Are there any programs that export RGBA JPEG images?

  2. Is there a more compact JPEG library than the official libjpeg v6 from the Independent JPEG Group. I only need loading, and no fancy stuff (no rescaling, palettizing etc). It should also be portable (e.g. Intels JPEG library won’t do)

JPEG is not encoded in a fashion that would make an alpha channel feasible or effective.

I recommend you stick with TGA if you like keeping alpha information with the image.

Yes, I know the lossy nature of JPEG (especially how it hurts sharp edges and areas of constant intensity, which is often important for the alpha channel).

However, I’m looking into the possibility to add (optional) JPEG support to the texture and image loading capabilities of GLFW. Currently only the TGA format is supported (and it’s supported very well).

I too prefer the TGA file format (or PNG when I can afford the size/overhead of the PNG library).

Anyway, I have still not found any answers to my original questions…


perhaps you should look for DevIl It is free and cross platform and easy to use with dozens of supported file formats.It also has a natural interface to DirectX, OpenGL and Allegro


if all else fails you might want to dump the alpha channel into a separate file (RAW format for example) and then assemble the image data from the jpeg and the RAW in your program which should be easy.
although that’s not as efficient as an RGBA jpeg might be it’s still better than a huge tga.


If you set the quality of JPEG to 100, then you wont notice anything and the compression will still be excellent.

I have used intel’s lib for this, but never actually used the image as a texture, (only for screenshot)

For textures, it is recommended to use lossless compression anyway …

PS: why do you care about hard disk space?


100% quality compresses lossless? hmmm i doubt that, there’s always a special case that proves assumptions wrong
probably he cares about HD space because he wants to put the thing on the web and wants small filesize.

Even if you did do 0 compression, you would still be putting a square peg in a round hole.