PIL Expand Canvas

D

Daniel Bowett

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?
 
W

Will McGugan

Daniel said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,278
Latest member
BuzzDefenderpro

Latest Threads

Top