[Image-SIG] antialiasing in pil

Kevin.Cazabon@gretag.com Kevin.Cazabon@gretag.com
Fri, 11 May 2001 11:04:33 -0600


"Anti-Aliasing" by definition is performed by rendering at a higher
resolution and downsampling using interpolation.  I'm not sure if PIL can
automatically do this for you, but it's not hard to do yourself:

-render at 2x, 3x, 4x, or higher resolution than you need
-downsample the image using "bicubic" to the real size

In other programs, you'll see the "Anti-aliasing" selection of "2x2, 3x3,
4x4", etc, and that's bascially the "oversampling" you're setting above.

Hope it helps...


Kevin Cazabon




                                                                                                                   
                    "Kees van                                                                                      
                    Drongelen /          To:     image-sig@python.org                                              
                    VisualSpace"         cc:     (bcc: Kevin Cazabon/sienna/gig)                                   
                    <kees@visuals        Subject:     [Image-SIG] antialiasing in pil                              
                    pace.nl>                                                                                       
                                                                                                                   
                    05/11/2001                                                                                     
                    10:00 AM                                                                                       
                                                                                                                   
                                                                                                                   





Hi there,


I'am new to pil and trying to create images dynamically in zope: I
believe pil supports antialiasing. The thing is I can draw things but
not smooth enough: please! does anybody knows what i'am doing wrong?


##################################################
# draw a smooth circle

##################################################

import Image, ImageDraw

dxy=100,100
bgcolor=255,0,0

pencolor=255,255,255
fillcolor=0,0,255

im = Image.new("RGBA",(dxy),(bgcolor))

########### draw something
draw = ImageDraw.Draw(im)

draw.ellipse((10,10, 90,90), outline=pencolor, fill=fillcolor)

del draw

im.save('output.png')
--
||||||||||||||||||||||||||||||||||||
VisualSpace
grafische en interactieve vormgeving

Krelagestraat 34
2012 CT Haarlem
T 023 532 33 66
F 023 532 33 04
http://www.visualspace.nl
||||||||||||||||||||||||||||||||||||

_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig