I have checked that a lot of images in a website are completely blank, ie, 500x500 with all pixels white. All the images are in subdirectories of the images directory. How can I check which ones are white? I am thinking on getting the names of these images.


  • I would like to use some bash script or command.
  • Imagemagick is installed
  • Server is Ubuntu 14.04
  • All images are .jpg extension
  • 3
    ...with a browser? with a script? with a "one-liner"? Do you have any command-line tools to do image analysis? – Jeff Schaller Oct 13 '16 at 17:58
  • good point, thanks. I am updating the question. – hosseio Oct 14 '16 at 6:31

If you have -- or can install -- the ImageMagick package, it has an identify utility that can print out a histogram of the colors in the file; the awk program below will scan the identify -verbose output for the number of colors and the colors listed in the histogram. If there is only one color listed and the only colors in the histogram are white, then it will return "success", otherwise "failure".

You can then wrap a shell script around awk and identify to flag matching files:

for f in images/*
  identify -verbose "$f" | awk -f iswhite.awk && echo "$f is an all-white image"


/Histogram:/ {
inhisto && /[[:digit:]]+: \([ [:digit:]]{3},[ [:digit:]]{3},[ [:digit:]]{3}\) #/ {
  if ($0 !~ /#FFFFFF white/) { nonwhite=1 }
/Rendering intent/ {
/Colors: / {
  if (ncolors == 1 && nonwhite == 0) { exit 0 } else { exit 1 }
  • It works like a charm. I have just edited the loop with a find to be able to retrieve the images in the subdirectories. Thanks – hosseio Oct 14 '16 at 7:39

Using findimagedupes:

# Look for and compare images that are 90% similar 
# in all subdirectories of the current directory.
findimagedupes -R -- .

The -t option controls how similar the images should be:

# Same as before but for images that are 99% similar.
findimagedupes -t 99 -R -- .

Suppose a directory had these files:

white.png foo.png. bar.png. baz.jpg green.png

...where white.png was known to be white, green.png was known to be green, and the other were uncertain. Since findimagedupes outputs any similar files on the same line, (space separated), this would show only the white ones:

findimagedupes -t 100 -R -- . | grep -w white.png

Output, (assuming bar.png is white):

white.png bar.png

See also: Command line tool to check whether two images are exactly the same graphically, and more generally: An intelligent duplicate file finder for Linux.

  • 1
    Actually, findimagedupes deliberately throws away colour information before comparing. A 100% white image would match a 100% green image just fine if both had maximum intensity They'd both have the fingerprint: //////////////////////////////////////////8= – jhnc Feb 2 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.