PIL and transparency in IE

Marek dlamarka at wp.pl
Thu Jun 26 03:08:31 EDT 2003


Hi,
I have big problem when i try generate a PNG image with transparent
background. When i open a source PNG file with tranasparent background
everything is going well but not in IE. I know that is a bug in IE.
But i can make PNG with transparent in PHP or graphic program it runs
well in IE (execly no with transparent background but with transaprent
object). But when I open it
in Python  the Python generates error:

 File "C:\WINDOWS\Pulpit\python\piatek\googlepl.py", line 33, in ?
    im.save(name, "PNG")
  File "C:\PYTHON22\Lib\site-packages\PIL\Image.py", line 1125, in
save
    self.load()
  File "C:\PYTHON22\Lib\site-packages\PIL\ImageFile.py", line 114, in
load
    Image.Image.load(self)
  File "C:\PYTHON22\Lib\site-packages\PIL\Image.py", line 507, in load
    apply(self.im.putpalette, self.palette.getdata())
  File "C:\PYTHON22\Lib\site-packages\PIL\ImagePalette.py", line 39,
in
getdata
    return self.mode + ";L", self.tostring()
  File "C:\PYTHON22\Lib\site-packages\PIL\ImagePalette.py", line 45,
in
tostring
    return array.array("B", self.palette).tostring()
TypeError: an integer is required

this is my cod:

im = Image.open("przez.png")
draw = ImageDraw.Draw(im)
font = ImageFont.truetype(FONTFILE, 56)
draw.text((450, 320), title, font=font, fill="black")
im.save(name, "PNG")

Can someone help??




More information about the Python-list mailing list