The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
pil and alpha
Discuss pil and alpha in the Python Programming forum on Dev Shed. pil and alpha Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

November 24th, 2003, 03:03 PM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
pil and alpha
hi, ive got a string in "L" i convert to RGB, how do i add an alpha channel with an alpha based on the L value
|

November 25th, 2003, 01:17 AM
|
|
Junior Member
|
|
Join Date: Nov 2003
Posts: 28
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Trivial:
PHP Code:
im1=im.convert("RGBA")
im1.putalpha(msk)
What's the problem?
|

November 25th, 2003, 08:28 AM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
thanks, how do i display it now? im still getting the same alpha over the whole image. should i be using glBlendFunc(GL_SRC_ALPHA,GL_DST_ALPHA)
|

November 25th, 2003, 08:30 AM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
also, should the alpha mask be from 0-255 ot 0.0-1.0?
|

November 25th, 2003, 09:29 AM
|
|
Junior Member
|
|
Join Date: Nov 2003
Posts: 28
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Quote: | how do i display it now? im still getting the same alpha over the whole image | I haven't got your point. Are you asking about PIL or about OpenGL? Quote: | should the alpha mask be from 0-255 ot 0.0-1.0? | Any of them - either mode "L" or "1", in PIL jargon. Alpha mask is full-blown PIL image, just single-banded one
|

November 25th, 2003, 09:45 AM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
sorry about the confusion, im having troubles varying the alpha in OpenGL. I can change the overall Alpha value using glColor4f but I see no varying alpha on the texture.
im assuming the alpha channel is int's 0-255 since the RGB channels are. the putalpha method comes up with no errors but i cant get getpixel(xy) to work. ive tried
im.getpixel([x,y])
im.getpixel(x,y)
temp=x*y
im.getpixel(temp)
|

November 25th, 2003, 04:07 PM
|
|
Junior Member
|
|
Join Date: Nov 2003
Posts: 28
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
you've almost caught it 
Code:
im.getpixel((x, y))
will return 4-tuple (if your image is really RGBA) of integers in 1..255 , like
Code:
(106, 106, 106, 196)
.
|

November 25th, 2003, 11:27 PM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
thanks man
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|