Looking for a JPEG package that will allow you to do this :
BYTE * RGBbuffer = ReadJPEGFile(filename,&width,&height);and this:
SaveJPG(RGBbuf, width, height...);? ? ?
Don't want to pay 100's of dollars?
Comfortable with C/C++ ?
Look no further!
What Is it?
The class is called JpegFile. It is based on a Win32 compilation of the IJG V.6a JPEG source. It does two main things :
IJG has released version 6b of their JPG read/write code. This class will work correctly with 6b. If you want to use 6b, you will need to make the same changes that I made for 6a.
This code was written with Visual C++ v5 and v6. We don't have code for Borland, VB or any other platform, sorry.
Color quantization code is based on Dennis Lee's DL1Quant.
1: This code entirely free - no royalties, no time bombs, no annoyance screens. All we ask is that you mention me in your software, especially if it's commercial software - and, if possible, add a link to our site.
2: Because it is free, however, there are no guarantees - use at your own risk!
3: The main reason for this package is to provide simple C++ JPG support. The BMP functions are in there only so that I won't have to answer the question "I got your JPG stuff, do you do BMP ?" The BMP support is not complete, it doesn't support RLE, or some of the more exotic bit depths.
4:Come to us first for help with this code.
We have packaged this code (along with PNG, TIFF, PhotoCD, Photoshop, BMP, PCX, TGA, WMF/EMF, i/o, hundreds of image processing routines, etc.) into a very powerful, but inexpensive, Win32 DLL and static library. If this interests you, click here.
This package is not the responsibility of the people who's code we have used here - the IJG people, for example. Please, come to us first with any problems you are having with this package.
Email questions to:
If you run into any problems with this software, please feel free to contact us. If it turns out that the problem is in our code, we will fix it. Please do not ask the IJG people, or any of the other people who's code we have included here for help unless we've first determined that the problem is not in our code (or your's).
If you feel the problem is with the IJG code that is included, we recommend you get a full copy of the official IJG source. The full IJG source comes with excellent documentation and should be able to help you. You can get the IJG code at the simtel archives.
"boolean" Redefinition Problem / Struct Size Mismatch Problem
Problem : There is some serious type conflict associated with the IJG code's use of the name "boolean" and MSVC 5.0's use of the name "boolean". In MSVC, "boolean" is a different size than it is in the IJG code (one is a char and one is an int). You typically run into this if you start using OLE stuff, which Dialog Apps come with by default. You will see lots of "struct mismatch" errors and your code won't run. It doesn't seem to happen in MSVC 4.x dialog apps.
from (line 228):
2. Compile Jpeglib2.lib as usual - ignore the warnings...
3. In your app, in jpegfile.cpp, add
Thanks to Bryce Burrows, Brian Krisler and Alexandre Maltais for taking the time to point out the problem.
VC 6 Problems
Microsoft has changed a lot of stuff behind the scenes. To fix the typedef problems that you will find if you try to compile this using VC6, you need to make the following change in jmorecfg.h :
change this :
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ typedef long INT32; #endifto this :
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ #include <basetsd.h> //typedef long INT32; #endif
Since the IJG source is essentially intact (but for two lines in jerror.c) you should be able to find all the answers you need in the full IJG distribution, which can be found here. You are strongly encouraged to look in the original IJG source for any questions you might have about using the JpegLib library. There is excellent documentation included in the IJG package, which will probably answer all of your JPG questions.
Bookmark this page. It is the official JpegFile Documentation!
Copyright © 2014, Smaller Animals Software, Inc.