[Chameleon] Setting quality for JPEG output

Tyler Mitchell tylermitchell at shaw.ca
Sun Jul 10 00:15:38 EDT 2005


> The reason for this, and other choices like the xml theme legend 
> wms_name thing come from Chameleon's roots as an OGC-specific tool 
> that 
> only worked with Context files.  In a context file, there is no 
> place 
> for image format and no way to set layer names.  So even though 
> Chameleon used a map file, we had to provide an alternate way to 
> handle 
> these types of issues.

Thanks Paul, I totally understand and am happy to see it get pushed beyond OGC specs :)
I still don't really believe that Chameleon will look for the imagetype from my map file though.  I've done a few tests where I have image_type = JPEG in my config/chameleon.xml file.  Then, in my map file I set:

OUTPUTFORMAT
  NAME JPEG
  DRIVER "GD/JPEG"
  MIMETYPE "image/jpeg"
  IMAGEMODE RGB
  EXTENSION "jpg"
  FORMATOPTION "QUALITY=65"
END

If I change QUALITY=xxx it doesn't affect the output all.  I also created a new format name "jpeg_q100" and put then in for image_type, but Chameleon bailed and didn't know what I meant.  What am I missing?  Do I need v2.2 to do this?

Jacob also mentioned "AUTO" but that fails.  I'm working on upgrading to 2.2, will that help?

Tyler

> 
> Some changes could be made to make a non-OGC method easier to work 
> with 
> but it means some work to go back and undo the code that makes 
> these 
> assumptions.
> 
> HTH
> 
> Paul
> 
> Tyler Mitchell wrote:
> > Thanks Jacod and Jason for the response.  I'm now hopeful.  I 
> haven't liked having a "site-wide" setting for image_type, so this 
> solution has been most helpful.  I'm still a bit skeptical that my 
> map file settings are being picked at all - but I'll get over it :)
> > 
> > Tyler
> > 
> > ----- Original Message -----
> > From: Jacob Delfos <jacob.delfos at maunsell.com>
> > Date: Friday, July 8, 2005 10:53 pm
> > Subject: RE: [Chameleon] Setting quality for JPEG output
> > 
> > 
> >>Hi Tyler,
> >>
> >>The imagetype set in chameleon.xml will determine what is being 
> >>used, 
> >>but it still listens to the settings in the mapfile. So if you 
> >>want a 
> >>jpeg with 60% quality, then you have to specify the quality 
> >>setting in 
> >>the output format, like this:
> >>
> >>       OUTPUTFORMAT
> >>               NAME jpeg
> >>               DRIVER "GD/JPEG"
> >>               MIMETYPE "image/jpeg"
> >>               IMAGEMODE RGB
> >>               EXTENSION "jpg"
> >>               FORMATOPTION "QUALITY=60"
> >>       END
> >>
> >>I think with the current setting of "auto" for image type, it 
> will 
> >>use 
> >>the imagetype setting in the mapfile as mapserver would do.
> >>
> >>The customisation I posted was for chameleon version 1. I have 
> >>changed 
> >>it a little to automatically detect whether a raster exists in 
> the 
> >>layers being drawn (while also using the "forcejpg" parameter in 
> >>the 
> >>metadata), and to switch to jpeg based on that. Let me know if 
> you 
> >>want 
> >>me to send it to you.
> >>
> >>regards,
> >>
> >>Jacob
> >>
> >>
> >>
> >>-----Original Message-----
> >>From: chameleon-bounces at lists.maptools.org
> >>To: Jason Grimes
> >>Cc: Chameleon User List
> >>Sent: 7/9/2005 1:00 PM
> >>Subject: Re: [Chameleon] Setting quality for JPEG output
> >>
> >>Hi Jason,
> >>In traditional MapServer applications, I've done it several 
> using the
> >>method you mentioned.  Are you saying that Chameleon actually 
> >>checks the
> >>IMAGETYPE from the map file?  I don't think so.  It ignores it 
> on mine
> >>and relies on the config/chameleon.xml image_type setting which 
> is 
> >>usedat map drawing time in the drawmap.php scripts.  As far as I 
> >>can tell,
> >>the only valid values for that setting are specific formats that GD
> >>supports and not related to the map settings for IMAGETYPE.  My 
> >>questionis really how to specify a quality setting for the 
> >>image_type that
> >>Chameleon uses, not how to set it in the map file.  If that 
> makes any
> >>sense...
> >>
> >>Am I'm going mad or is this tricky for everyone else too?
> >>
> >>Tyler
> >>
> >>----- Original Message -----
> >>From: Jason Grimes <jgrimes at gi.alaska.edu>
> >>Date: Friday, July 8, 2005 3:40 pm
> >>Subject: Re: [Chameleon] Setting quality for JPEG output
> >>
> >>
> >>>Hi Tyler,
> >>>
> >>>You set this with FORMATOPTION in the OUTPUTFORMAT block of 
> >>
> >>your map
> >>
> >>>file.  Here is what I have mine set to...
> >>>
> >>>       IMAGETYPE jpeg
> >>>       IMAGECOLOR 255 255 255
> >>>                                                 
> >>>       OUTPUTFORMAT
> >>>               NAME jpeg
> >>>               DRIVER "GD/JPEG"
> >>>               MIMETYPE "image/jpeg"
> >>>               IMAGEMODE RGB
> >>>               EXTENSION "jpg"
> >>>               FORMATOPTION "QUALITY=100"
> >>>       END
> >>>
> >>>The IMAGETYPE must match the NAME in OUTPUTFORMAT.
> >>>
> >>>Jason G
> >>>
> >>>On Fri, 2005-07-08 at 11:20, Tyler Mitchell wrote:
> >>>
> >>>>Jacob,
> >>>>I just discovered your drawmap mods for setting imagetype based
> >>>
> >>>on layer
> >>>
> >>>>metadata -- very good!
> >>>>http://lists.maptools.org/pipermail/chameleon/2004-
> >>>
> >>>August/001253.html> It is just what I have been needing.
> >>>
> >>>>Does anyone know if I can set the compression/quality for JPEG
> >>>
> >>>output?
> >>>
> >>>>I know how I'd do it in a map file, but $szImgType in
> >>>
> >>>drawmap.php seems
> >>>
> >>>>to only refer to image format, not sub-settings for that format.
> >>>>
> >>>>Can anyone give me some pointers?
> >>>>
> >>>>Tyler
> >>>>_______________________________________________
> >>>>Chameleon mailing list
> >>>>Chameleon at lists.maptools.org
> >>>>http://lists.maptools.org/mailman/listinfo/chameleon
> >>>
> >>>_______________________________________________
> >>>Chameleon mailing list
> >>>Chameleon at lists.maptools.org
> >>>http://lists.maptools.org/mailman/listinfo/chameleon
> >>>
> >>
> >>_______________________________________________
> >>Chameleon mailing list
> >>Chameleon at lists.maptools.org
> >>http://lists.maptools.org/mailman/listinfo/chameleon
> >>
> >>_______________________________________________
> >>Chameleon mailing list
> >>Chameleon at lists.maptools.org
> >>http://lists.maptools.org/mailman/listinfo/chameleon
> >>
> > 
> > 
> > _______________________________________________
> > Chameleon mailing list
> > Chameleon at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/chameleon
> > 
> 
> -- 
> +-----------------------------------------------------------------+
> |Paul Spencer                           pspencer at dmsolutions.ca   |
> +-----------------------------------------------------------------+
> |Applications & Software Development                              |
> |DM Solutions Group Inc                 http://www.dmsolutions.ca/|
> +-----------------------------------------------------------------+
> 



More information about the Chameleon mailing list