Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 24th, 2003, 03:03 PM
jpjp jpjp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 11 jpjp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old November 25th, 2003, 01:17 AM
Igor Pechersky Igor Pechersky is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 28 Igor Pechersky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Trivial:
PHP Code:
 im1=im.convert("RGBA")
im1.putalpha(msk
What's the problem?

Reply With Quote
  #3  
Old November 25th, 2003, 08:28 AM
jpjp jpjp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 11 jpjp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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)

Reply With Quote
  #4  
Old November 25th, 2003, 08:30 AM
jpjp jpjp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 11 jpjp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
also, should the alpha mask be from 0-255 ot 0.0-1.0?

Reply With Quote
  #5  
Old November 25th, 2003, 09:29 AM
Igor Pechersky Igor Pechersky is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 28 Igor Pechersky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #6  
Old November 25th, 2003, 09:45 AM
jpjp jpjp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 11 jpjp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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)

Reply With Quote
  #7  
Old November 25th, 2003, 04:07 PM
Igor Pechersky Igor Pechersky is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 28 Igor Pechersky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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)
.

Reply With Quote
  #8  
Old November 25th, 2003, 11:27 PM
jpjp jpjp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 11 jpjp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks man

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > pil and alpha

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap