No direct way as far as I can tell. You can use several calls with Gimp histogram, adjusting the upper limit of the range until you don't get any pixels in the range:
The call is:
The values you are interested in are count and/or percentile (as far as I can tell, count=pixels*percentile).
You use:
and you try max values (with a dichotomic search you'll never need more than eight calls), something like:
However doing a color selection on the result may select a single pixel and may not give you the result you want. What is the whole process?
The call is:
Code:
mean, std_dev, median, pixels, count, percentile = pdb.gimp_drawable_histogram(drawable, channel, start_range, end_range)
The values you are interested in are count and/or percentile (as far as I can tell, count=pixels*percentile).
You use:
Code:
_,_,_,_, count,_ = pdb.gimp_drawable_histogram(drawable, HISTOGRAM_VALUE, 0.,max)
and you try max values (with a dichotomic search you'll never need more than eight calls), something like:
Code:
def blackest(drawable):
bot,top=0.,1.
while top-bot>.001:
print "%5.3f < x < %5.3f" % (bot,top)
threshold=(top+bot)/2.
_,_,_,_,count,_ = pdb.gimp_drawable_histogram(drawable, HISTOGRAM_VALUE, 0.,threshold)
print "%5.3f px @ %5.3f" % (count,threshold)
if count:
top=threshold
else:
bot=threshold
return threshold
However doing a color selection on the result may select a single pixel and may not give you the result you want. What is the whole process?