[Image-SIG] help with paste

Gregory Haley ghaley@venaca.com
Fri, 23 Jun 2000 14:43:11 -0400


hi folks,

i am trying to get some images to paste into a larger
image.  from the docmentation, it appears that i need to use
paste, but i keep getting an error when i try to do the
paste that the images don't match.

i suspect i a missing something fairly obvious were i better
at reading the method prototype.  attached is the pertinent
snippet of code.

*-*-* snip *-*-*

im1 = Image.new('RGB', (size0, size0))
draw = ImageDraw.ImageDraw(im1)
ink = (0,0,0)
fill = (255,0,255)
draw.rectangle( [0, 0, size0, size0], fill=fill,
outline=ink)

size1 = 300
im2 = Image.new('RGB', (size1, size1))
draw = ImageDraw.ImageDraw(im2)
ink = (0,0,0)
fill = (255,255,0)
draw.rectangle( [0, 0, size0, size0], fill=fill,
outline=ink)

im3 = Image.new('RGB', (size0, size0))
draw = ImageDraw.ImageDraw(im3)
im = im1.paste(im2, (500, 500), im3)

*-*-* snip *-*-*

what i want to create is something along the following:

the *** will be rectangles, the lengths based on data passed
in, and the colors changing to differentiate categories. 
the widths of each rectangle will be 10, the distance
between each rectangle will be 5px.  the heighth of the box
will be a function of the number of rectangles needed, and
the width of the box will be a function of the length of the
longest rectangle plus +/- 10px.  the final image will be
passed via zope into a dtml method and will not be a real
file.  there is a zope Poll product that uses the pie slice
funtion in PIL to do this.  it seems like it would be
possible to do this.

	+----------------------------+
	|                            |
	| *****                      |
	|                            |
	| ************               |
	|                            |
	| *********                  |
	|                            |
	| **********************     |
	|                            |
	+----------------------------+

i have gotten it to where i can generate all of the part as
gif files, but doing this dynamically continues to ellude
me.  any insights will be most appreciated.

any help will be greatly appreciated.

thanks.

ciao!
greg.

Gregory Haley
venaca.com