[Image-SIG] How to add a frame + caption to another image?
dave at leviathangames.com
Mon Feb 19 17:35:00 CET 2007
Matthew Wilson wrote:
> Later on, I'd like to dynamically add any arbitrary text to the bottom of
> the image. I suspect this is straightforward also.
I recently needed to add attributions to a directoryful of images:
labelImage=Image.new("RGBA", sz, (0,0,0,0))
# n.b. use the label image's alpha channel as the mask for the paste
This code draws text in yellow vertically down the image from the upper
left. In my actual script, I position the text a little more pleasingly.
The only interesting thing that's going on there is that if you omit the
"mask" argument to the "paste" method call:
you end up overwriting the image with transparent pixels, which is probably
not what you're interested in.
The subject suggests you're also interested in adding a frame around an
image - I'd probably do this something like so:
framedImage=Image.new("RGB", framedSize, frameColor)
Hope this helps,
More information about the Image-SIG