RSS/Atom feed Twitter
Site is read-only, email is disabled

Scripting questions...

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Scripting questions... Jerry Baker 26 Nov 16:35
  Scripting questions... David Gowers 26 Nov 23:52
Scripting questions... Saul Goode 27 Nov 02:12
Jerry Baker
2006-11-26 16:35:55 UTC (over 17 years ago)

Scripting questions...

Using python, I'm trying to find the color that is used on a layer. The layer has an alpha channel and it only uses 1 color on the layer. The problem is, I don't know where the colored pixels are. It may only be one pixel anywhere on the layer, or the entire layer may be filled.

I also need to find the color used on a text layer...

Anyone have any ideas ?

Thanks a million...

jbaker

David Gowers
2006-11-26 23:52:06 UTC (over 17 years ago)

Scripting questions...

On 11/27/06, Jerry Baker wrote:

Using python, I'm trying to find the color that is used on a layer. The layer has an alpha channel and it only uses 1 color on the layer. The problem is, I don't know where the colored pixels are. It may only be one pixel anywhere on the layer, or the entire layer may be filled.

The only way I know is the slow way:

* initialize a pixel_rgn * iterate across rows and down columns * look at each pixel. if its alpha is non-zero (ie. ord(pixval[3]) > 0)) then store the color and exit the loop.

I also need to find the color used on a text layer...

This (and the other text data) is stored in a parasite attached to the text layer. The parasite data is textual, and easy to understand.

Saul Goode
2006-11-27 02:12:05 UTC (over 17 years ago)

Scripting questions...

A destructive way (i.e., work on a duplicate) of doing this would be to scale your layer down to 1x1 pixels and then fetch the color of that pixel (using the PDB function 'gimp-drawable-get-pixel')

Using python, I'm trying to find the color that is used on a layer. The layer has an alpha channel and it only uses 1 color on the layer. The problem is, I don't know where the colored pixels are. It may only be one pixel anywhere on the layer, or the entire layer may be filled.

I also need to find the color used on a text layer...

Anyone have any ideas ?

Thanks a million...

jbaker