Alley in Pisa, Italy

by Lars Kotthoff

submit your photo


Hall of Fame
View past winners from this year

Please participate in Meta
and help us grow.

Take the 2-minute tour ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

Is anybody aware of free software that can sort your pictures by overall color (or color of a specific region of an image)?

I've checked this question and looked into imgSeek, but the Mac version download links to a Japanese news site.

I've also tried the experimental feature in Picasa, but it 1) doesn't sort (it only searches) and 2) doesn't have a wide breadth of options to choose from.

share|improve this question
    
What are you trying to accomplish with this? –  mattdm Oct 11 '13 at 1:05
    
I have a directory full of images, and I'm hoping to somehow sort these images (so that, say, all of the predominantly red images appear first). Does that make sense? –  Atticus29 Oct 11 '13 at 2:12
    
Sure, that helps. But, why? –  mattdm Oct 11 '13 at 2:33
    
Because they are images of moths that I have to identify by species, and it will greatly help my workflow if similarly-colored moths are adjacent. –  Atticus29 Oct 11 '13 at 14:53

1 Answer 1

ImageMagick is your friend

~> convert image.jpg -gravity center -crop 80x80%+0+0 -scale 1x1\! txt:-
# ImageMagick pixel enumeration: 1,1,255,srgb
0,0: (131, 89, 61)  #83593D  rgb(131,89,61)

This works by cropping away the outer 20% edge (gravity center indicates a crop of the outside edges). It then scales the image down to a single pixel and outputs that to the screen (if you replace the - at the end of the line with a filename you can write the output to a file). You can also experiment with resize/filter options, but scale is going to be quite a bit faster and for this application, I expect perfect.

Note that these values are Red/Green/Blue values, how you sort is another issue. You can pick the highest values and assume it is predominant, but that is probably not going to get the result you want, changing to either HSL or HSB is probably going to provide a more useful set of values for sorting:

~> convert image.jpg -gravity center -crop 80x80%+0+0 -scale 1x1\! -colorspace hsl txt:-
# ImageMagick pixel enumeration: 1,1,255,srgb
0,0: ( 19, 76,162)  #134CA2  hsl(7.46929%,29.8466%,63.5111%)

HSB:

~> convert image.jpg -gravity center -crop 80x80%+0+0 -scale 1x1\! -colorspace hsb txt:-
# ImageMagick pixel enumeration: 1,1,255,srgb
0,0: ( 19, 75,190)  #134BBE  hsb(7.46929%,29.276%,74.4015%)

Sorting from here is not too difficult in shell script.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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