With PIL... paste image on top of other with dropshadow

Matimus mccredie at gmail.com
Fri Feb 23 14:16:36 EST 2007


two things,

change the following line:
[code]
  back = Image.new(image.mode, (totalWidth, totalHeight), background)
[/code]
To:
[code]
  back = Image.new("RGBA", (totalWidth, totalHeight), background)
[/code]

and then do something like this:
[code]
  import sys

  bg = Image.open(sys.argv[1])
  image = Image.open(sys.argv[2])

  image = dropShadow(image,shadow=(0x00,0x00,0x00,0xff))
  bg.paste( image, (50,50), image )

  bg.show()
[/code]

Where the shadow color specifies an alpha transparency value.




More information about the Python-list mailing list