0

I do not understand why my call to pdb.gimp_histogram throws a RuntimeError: execution error.

from gimpfu import *

def plugin_main ( timg, tdrawable ):

    pdb.gimp_histogram( tdrawable, 0, 0, 255 )

According to the docs, the function takes four arguments:

  • drawable ( type drawable)
  • channel to modify ( type int )
  • start range ( type int )
  • end range ( type int)

I provide all four in the barebones code above, so why is the error thrown?

Jet Blue
  • 5,109
  • 7
  • 36
  • 48

1 Answers1

1

The code looks correct (I have similar code that works).

However I get the same error if the image is color-indexed, while the doc says "The drawable may not be indexed.", so that could be your problem?

PS: You should use the named constants (HISTOGRAM_{VALUE|RED|BLUE|GREEN|ALPHA})

xenoid
  • 8,396
  • 3
  • 23
  • 49
  • Oh wow, thanks! That's exactly the problem. I somehow missed that part when reading. I was using the histogram window for testing and it works with indexed images so I just assumed the procedure would be the same. Is the solution then to create a temporary version of the image that is another format and use that to get the histogram data? (I am trying to count pixels by color). – Jet Blue Nov 28 '18 at 19:31
  • No better way off the top of my head, but it's getting late here. – xenoid Nov 29 '18 at 00:16