that is weird because once opened in Gimp a file is not anymore a jpg ,bmp, png or whatever but a gimp-imagine that may be in RGB, RGBA, index or Greyscale mode.
So the original format ,jpg,xcf,bmp does not matter just need to be a kind of file that gimp may open
"Can someone help me? "
Try again checking that the image is in RGB mode
I have a black and white (binary) image in bmp format. I'm trying to write a batch program that access images and output the number of white pixels. I've tested the following command in the script-fu console after loading the image:
(gimp-histogram drawable 0 1 1)
The above command would fail. However, if the same black & white image is saved in jpg format and a similar command is executed, it would work:
(gimp-histogram drawable 0 255 255)
The bmp image is not in RGB mode (because it's a binary image?). Do I need to convert it to RGB before?
Further clarification, the above posting was mine (I forgot to login!).
I've converted the bmp image to RGB using gimp-image-convert-rgb. I executed the histogram command on this converted image, and got the correct result.
Does the histogram function work on RGB image only then?
I think you are using wrong terminology. gimp-histogram is a function in the gimp API (application programming interface), not a plugin. You can call it from the script-fu console, as you have done.
As far as I can tell from browsing .bmp files in windows, they are all of mode "indexed." The on-line documentation for gimp-histogram says it will NOT work for an image of mode "indexed."
In Gimp, images are of one of the modes RGB, grayscale, or indexed. (There is a little more too it, an image can also have an alpha channel. An RGB image with an alpha channel might be described as of mode RGBA, for some purposes.)
I suppose mode indexed has one channel. The value in the channel is a reference to a particular color, not a value of R, G, B, or B/W.
So, yes, you probably should convert to greyscale or RGB before calling gimp-histogram.
I could be wrong.
plashless, off banks of noon
thanks
You should decribe what
gimp-histogram
Clarifying the gimp-histogram problem
Clarifying the gimp-histogram problem
gimp-histogram is a function, does not work on indexed
i believe so, ...i never