

Hopefully you can see the first line is 4 red pixels, the second line is 4 green ones. rgb, you can tell ImageMagick like this: convert -size 4x4 xc:red xc:green xc:blue +append -depth 8 RGB:x.raw If you want to use an extension different from. ImageMagick uses the file extension to determine the format, and rgb means RGB!. If we look at the file, we can see it is 144 pixels long, 16 red pixels, 16 green pixels, 16 blue pixels - therefore 48 pixels altogether - and each one with a single byte of R, G and B. # ImageMagick pixel enumeration: 12,4,255,srgbīut you say that it takes too long to get one 1 pixel, so you can convert the image to a file that is just pure RGB values and read that: convert -size 4x4 xc:red xc:green xc:blue +append -depth 8 x.rgb Now, we can look at it in text format: convert -size 4x4 xc:red xc:green xc:blue +append -depth 8 txt: Let's create a small image from the command line, with 3 squares, each 4x4 pixels, one red, one green and one blue all in a horizontal row: convert -size 4x4 xc:red xc:green xc:blue +append a.gif You provided no details of your environment, programming language, application or anything much, however, this may get you started. I am not sure how you do that with Java, but in Ruby you do: image"]Īnd in Perl you do: my $image = Image::Magick->new If you simply want to check whether the image consists of only a single colour, you can ask ImageMagick to count the colours, like this (using the same image as below): identify -format "%k" a.gif There must be a system() or shell_exec() or popen() in Java that could run that so you could get the output. If you want to amortize the cost of running identify across lots of images for better performance, you can do something like this - where %k gives you the number of colours and %n gives you the filename: identify -format "%k:%f\n" *.jpg
