Gimp-Forum.net
Can gimp-image-pick-color return Alpha? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: Can gimp-image-pick-color return Alpha? (/Thread-Can-gimp-image-pick-color-return-Alpha)



Can gimp-image-pick-color return Alpha? - Jack Parker - 12-12-2019

It seems thatĀ gimp-image-pick-color returns only a 3-tuple even for an RGBA image
Is there a way to provoke it to report all four components?
(or average all four in a radius)

Googling, I find that the GUI color picker will display all the values if you hold SHIFT...
But I need to know if a pixel is transparent from within a script.


RE: Can gimp-image-pick-color return Alpha? - Ofnuts - 12-13-2019

If you need to know for a pixel, use pdb.gimp_drawable_get_pixel(drawable,x,y) that returns 4 values (if there is an alpha channel). Note that this doesn't take in account the layer mask, if any.


RE: Can gimp-image-pick-color return Alpha? - Jack Parker - 12-15-2019

Thanks, that does the needful.