Comments in generated JPEGs

Frank Warmerdam warmerdam at POBOX.COM
Thu Jun 22 10:23:50 EDT 2006


Stephen Davies wrote:
> My latest addition to my Mapserver application is a 3G phone interface.
> 
> However, it seems that at least the Motorola 3vx phone cannot handle 
> comments in JPEG images. 
> 
> The images generated by Mapserver/gd have the comment:
> CREATOR:gd-jpeg V1.0 (using IJG JPEG v62), quality=80
> and the phone refuses to display them.
> If I manually remove the comment with gimp, the images display 
> perfectly.
> 
> Does anybody know how to stop Mapserver/gd from including the comment?

Stephen,

As far as I know, you would need to patch the version of GD you are using.
If you look in GD's gd_jpeg.c file you should see a code segment like:

   jpeg_start_compress (&cinfo, TRUE);

   sprintf (comment, "CREATOR: gd-jpeg v%s (using IJG JPEG v%d),",
	   GD_JPEG_VERSION, JPEG_LIB_VERSION);
   if (quality >= 0)
     sprintf (comment + strlen (comment), " quality = %d\n", quality);
   else
     strcat (comment + strlen (comment), " default quality\n");
   jpeg_write_marker (&cinfo, JPEG_COM, (unsigned char *) comment,
		     (unsigned int) strlen (comment));
   if (im->trueColor)
     {
   ...

try changing this to:

   jpeg_start_compress (&cinfo, TRUE);
   if (im->trueColor)
     {
   ...

Quite a lame "feature" of the phone if you were to ask me!

Good luck,
-- 
---------------------------------------+--------------------------------------
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    | President OSGF, http://osgeo.org



More information about the mapserver-users mailing list