[mapserver-users] JPG Raster Problems

Frank Warmerdam warmerdam at pobox.com
Mon Oct 21 08:57:47 EDT 2002


Lowther, David W wrote:
> I am trying to use JPG images as raster layers and get the following error:
> 
> CGI Error
> The specified CGI application misbehaved by not returning a complete set of
> HTTP headers. The headers it did return are:
> 
> JPEG parameter struct mismatch: library thinks size is 432, caller expects
> 464
> 
> I have the image as a TIF also (same coordinates / projection / etc...) and
> it works ok. I have looked through the archives and it seems like this
> problem may be a result of not having something right with GDAL, but thats
> just a best guess.
> 
> Since I sent this message on 10/11 I came across something about mapserver
> only supporting 8 bit images. Is this the problem?
> 
> Any ideas or help would be much appreciated.

Dave,

The problem not 8 vs. 16 or 32bit images, but that your libjpeg was built
with different definitions for key structures than the code that is calling
libjpeg (either MapServer directly, or GDAL depending on how things are built).

I presume you are working on Windows, is that right?  I ran into a similar
problem in libtiff's use of libjpeg, and ended up having to declare something
like this after including something that pulled in rpcndr.h, and before
jpeglib.h.

/*
    The windows RPCNDR.H file defines boolean, but defines it with the
    wrong size.  So we declare HAVE_BOOLEAN so that the jpeg include file
    won't try to typedef boolean, but #define it to override the rpcndr.h
    definition.

    http://bugzilla.remotesensing.org/show_bug.cgi?id=188
*/
#if defined(__RPCNDR_H__)
#define HAVE_BOOLEAN
#define boolean unsigned int
#endif

#include "jpeglib.h"
#include "jerror.h"

If your libjpeg is being used directly from MapServer, perhaps you need to do
this in mapraster.c in the USE_JPEG block.

If you find the solution to your problem I would also encourage you to submit
the issue and fix into bugzilla so it can be applied to the core.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the mapserver-users mailing list