[magick-users] Brightest Pixel Location

Fred Weinhaus fmw at alink.net
Tue Apr 15 17:15:30 PDT 2008


The closest that I can come is as follows: Assume the brightest pixel 
is graylevel 255 (8-bit) or 65535 (16-bit) which in fx both become 
1.0. If you want to find all pixels that have an intensity of 1.0 
(graylevel) then use:

convert rose: -type Grayscale -fx "u==1?debug(u):1; u" null:
ROSE[11,61].red: u=1
ROSE[11,61].green: u=1
ROSE[11,61].blue: u=1
ROSE[15,62].red: u=1
ROSE[15,62].green: u=1
ROSE[15,62].blue: u=1
ROSE[16,62].red: u=1
ROSE[16,62].green: u=1
ROSE[16,62].blue: u=1
ROSE[16,63].red: u=1
ROSE[16,63].green: u=1
ROSE[16,63].blue: u=1
ROSE[37,14].red: u=1
ROSE[37,14].green: u=1
ROSE[37,14].blue: u=1
...


If you have a particular color (in this case r==1,g==1,b==1), you can do:

convert rose:  -fx "r==1&&g==1&&b==1?debug(u):1; u" null:


See: debug under fx escapes:

http://www.imagemagick.org/Usage/transform/#fx_escapes




>Hello, I am working on an application that requires the location of the
>brightest pixel in an image.  I have looked through the documentation with
>the -fx option and -evaluate, however, I cannot seem to get an output of the
>(x,y) of the brightest pixel.  Any help would be greatly appreciated, thank
>you in advance.
>
>-Nikolaus


More information about the Magick-users mailing list