No anti-aliasing for cartoline symbol?

William K woklist at CHARTER.NET
Mon Apr 4 18:55:15 EDT 2005


Well, I don't use the PHP-included GD with PHP.  of course, I don't use
imageantialias.  let's see, here's an outline:

1. mapfile is set up 2x size, say.  Use the usual map->draw and
mapimage->savewebimage to get your temp image and a URL for that.

2. transform the image URL to a file path and load the image with
imagecreatefrompng(), or whatever format you used

3. create an empty image with the target image size
(imagecreatetruecolor())

4. scale the loaded image into the empty image - imagecopyresampled

5. save the resampled image over the Mapserver-generated temp file


A few notes:

Since there is not control over scalebar line weights, I draw a
scalebar manually and merge that with the resampled image before saving
it.  The same goes for legends (I use an html legend).  And maybe for
other embedded image items.

You need to scale image coordinates received from user clicks back to
the 2x size before sending them to MS zoom functions.

Set everything in the map file to draw without antialiasing, including
type and symbols from fonts, or they will come out a bit thin.

Of course, you need to create symbols and patterns based on images at
the larger size.

The larger the initial image, the longer it takes MS to draw it
(scaling and loading aren't affected as much).  I find that 2x size
gives a good speed vs. image quality balance, but 4x gives a better
image if you have the CPU power.


On Apr 4, 2005, at 5:02 PM, Camden Daily wrote:

> William
>
> I tried your method of antialiasing that you'd suggested on the
> mapserver mailing list.  My only issue is that the PHP function
> imageantialias says this on the php.net site:
> Note: This function is only available if PHP is compiled with the
> bundled version of the GD library.
>
> Did you have to build your mapserver against the GD that came bundled
> with PHP?  I had run into issues when the two were compiled against
> different GD installs.
>
> Any help you could offer on this would be greatly appreciated.
>
> -Camden
>
>> I switched to a different method that gives accross-the-board
>> antialiasing - design and draw the map at 2x or 4x size with no
>> antialiasing anywhere, then use PHP's image functions to resample the
>> image with antialiasing.  I find that the antialiasing produced this
>> way looks much better, closer to what I expect from using graphics
>> programs, even for font rendering.  Requires PHP-MapScript of course,
>> and a bit of programming, but it works fine.  Unless you have a fast
>> processor, the 4x will be pretty slow, but it looks better.  I even
>> use
>> this method for generating high quality PDF output, instead of using
>> mapserver's builtin PDF output.
>
>
-----
William Kyngesburye <kyngchaos at charter.net>
http://webpages.charter.net/kyngchaos/

"Those people who most want to rule people are, ipso-facto, those least
suited to do it."

- A rule of the universe, from the HitchHiker's Guide to the Galaxy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2978 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050404/320d626a/attachment.bin


More information about the mapserver-users mailing list