seanyo / Hello-I-Tweet-As

Name Tags are Back...in Twitter Form! Twitter's the New Name Tag!
itweet.as
2 stars 2 forks source link

Alpha transparencies don't work #22

Closed seanyo closed 11 years ago

seanyo commented 13 years ago

Alpha transparencies are rendered as black:

Example ID: http://twitter.com/#!/ginader

ccharles commented 13 years ago

Due to the way that ReportLab handles image transparency this looks like it will be a real pain. Too bad, since PNG has such good built-in alpha transparency support...

seanyo commented 13 years ago

I found this on Stack Overflow; perhaps it will help:

Question

I have two PNGs that I am trying to combine into a PDF using ReportLab 2.3 on Python 2.5. When I use canvas.drawImage(ImageReader) to write either PNG onto the canvas and save, the transparency comes out black. If I use PIL (1.1.6) to generate a new Image, then paste() either PNG onto the PIL Image, it composits just fine. I've double checked in Gimp and both images have working alpha channels and are being saved correctly. I'm not receiving an error and there doesn't seem to be anything my google-fu can turn up.

Has anybody out there composited a transparent PNG onto a ReportLab canvas, with the transparency working properly? Thanks!

Answer

passing the mask parameter with a value of 'auto' to drawImage fixes this for me.

drawImage(......., mask='auto')

Source: http://stackoverflow.com/questions/1308710/transparency-in-pngs-with-reportlab-2-3

ccharles commented 13 years ago

Thanks, Sean.

Unfortunately this doesn't seem to work.

ccharles commented 13 years ago

Rather, it does seem to work with some profile pictures (e.g. http://twitter.com/#!/seydoggy) but not others (e.g. http://twitter.com/#!/ginader).

tejastank commented 11 years ago

Hello,

drawImage(......., mask='auto') works perfectly.

System: ubuntu 12 , python 2.7

seanyo commented 11 years ago

@tejastank Thanks! I was going to ask if you tested with the images listed by @ccharles, but it appears that Twitter no longer supports transparent PNGs.

https://twitter.com/thomasfuchs/status/252151280842186753

That being said - I'd prefer to resolve the issue in case they come back or in case the code gets extended to pull content from a Twitter Compatible API or another source of user profiles.

What do you think @ccharles

ccharles commented 11 years ago

I would love to see the official announcement of this new Twitter "feature". The wording would be interesting…

Since we cannot test against the images that used to fail I'm inclined to close this issue as no longer valid. We can always reopen if and when it comes up again.