Post Reply 

Detecting transparency?

Jun 20, 2014, 10:41
Post: #1
Detecting transparency?
I'd like to be able to tell if a pixel of a drawable is transparent. I've tried comparing pdb.gimp_drawable_get_pixel()[1] (accessing the second element as to not include the channel number) with (0, 0, 0, 0), but that isn't working.

Does anybody know the RGBA value for transparency? Or some other way of detecting that a pixel is transparent?
Find all posts by this user
Quote this message in a reply
Jun 20, 2014, 11:37
Post: #2
RE: Detecting transparency?
A transparent pixel can have any color (and any level of transparency). The A in RGBA is the alpha channel, and therefore the opacity. So you just have to test the A value (0:transparent, 1.0 or 255: opaque, or any value in between).

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jun 20, 2014, 12:15
Post: #3
RE: Detecting transparency?
Oh yeah of course, I can just check for the A value to be 0 (in my case I want to check for complete transparency). I can't believe I hadn't thought of that, thanks!
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Auto transparency dbuske 2 1,067 Jan 25, 2013 18:44
Last Post: dbuske
  Resize image batch with a minimum of 10px transparency border Bad Pie 5 2,001 Sep 28, 2011 18:03
Last Post: Bad Pie

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS