Shyru's World

Thursday, October 14, 2004

Antialiasing with PHP

Today i updated the website of our company. And i also managed to fix one thing that bothered my since it existed: Smooth, antialiased rounded edges in HTML. Well, i had rounded edges quite some time now. I did it with a special PHP image generator which generated rounded-edge images on the fly in the colors you needed. That worked quite well, but unfortunatly the rounded edges where not antialiased.
So today i looked at that matter again, and tried to use the ImageAntialias() function of PHP. Of course did that not work with ImageFilledEllipse() that i used. So i thought about a better solution to get an antialiased round edge. Suddenly the technique used in todays graphicscards came to my mind: Supersampling.
So now I have images with 10xAA. That was the trick: I "rendered" the image in a resolution 10 times higher than needed and then downsampled the image to the requested size using ImageCopyResampled(). It's a bit slow but since the images are cached anyway its not a big matter. And it works quite nice. If you want to take a look at it visit to www.eudig.com - Contact page
If you are interested in that feel free to contact me.

Away from work I'm also rather busy. Coming weekend I'll be away for a recreational with my youth group. Since I'm member of the staff I have quite some things to prepare.

3 Comments:

  • I just found this suggestion. I was struggling with a similar problem of skewing an image not having antialiased edges. Now solved!

    Thanks!

    By Anonymous Anonymous, at 6:33 PM  

  • Warning: fopen(../../res/usr/en/misc/menu_kontakt.xml): failed to open stream: No such file or directory in /var/www/www.eudig.de/modules/sys/bmenuex.inc.php on line 284
    could not open XML input

    By Anonymous Anonymous, at 11:42 AM  

  • check out this class which might be handy php rounded thumbs

    By Anonymous Anonymous, at 1:49 PM  

Post a Comment

<< Home