PIL Expand Canvas

Will McGugan news at NOwillmcguganSPAM.com
Sat Feb 19 19:34:46 EST 2005


Daniel Bowett wrote:
> I'm new to the PIL module but think it would be useful for dealing with 
> all the product images for the sites I work on. I can see how to do most 
> things I need apart from expanding the canvas.
> 
> By that I mean if I have an image which is 200 pixels high and 180 
> pixels wide - I will want to pad it left and right by 10 pixels with 
> white space to make it a 200x200 square.
> 
> Is this possible?

You could create a new canvas of the larger dimensions, then copy the 
smaller one to the centre of it..

Will McGugan



More information about the Python-list mailing list