So I've searched the internet/google up and down for at least 3 hours and still haven't found anything that works:

I have those small .png files that are photographed color samples of products and I need to make a catalogue.

I need to sort/arrange these samples BY COLOR in a harmonious way and so far I've done this by hand but it's a tedious task and it's driving me nuts.

I really want to sort them by algorithm / via software in a layout of my choosing (10 columns by 8 rows).

I thought this would be easy and there actually are 2-3 applications that were written sometime in the 90's and sort of do what I need.. but! they are broken as sh** and basically unusable for my purposes.

Here's the programs that I tried for image sorting purposes:

ImageSorter (all versions I could find): This is the main one that gets recommended all over the net, in dubious and completely forsaken discussion threads from seasons past. It's crap and I can't use it..NO ONE should use it. Please don't use it, it will just crash and disappoint you.

OSForensics: This is the only other software I tried that was actually kind of doing what I needed: Sorting the images by color. But, once again, the results were very bad and all over the place.

I tried 1 or 2 more programs with names like ImageView or something like that, but nothing worked.

I also searched stackoverflow for some homebrew self-coding solution but no one seems to even have this problem (which is rare) so I'm completely stuck now.

Thanks for reading and if anyone out there can point me in the right direction: That would be beyond greatness! :)


  • Hi Colorswatch Enthusiast, Welcome to GD.SE! Please mention what operating system you're using. My best guess would be to order the colors based on the file name. But you would have to change all of the file names into the order you would like. Ex: 001-Blue-Product, 002-Teal-Product.
    – AndrewH
    Commented Apr 26, 2016 at 18:18
  • If they are actually well-cropped shots of s single color swatch, you can probably use imagemagik command line to blur a little and sample the center of the image. To emit the color value of a pixel (sample assume image named rose) in an image: convert rose: -format '%[pixel:p{40,30}]' info:- which would emit something like rgb(232,254,252) which can then be appended to a file name. ( imagemagick.org/Usage/quantize/#extract )
    – Yorik
    Commented Apr 26, 2016 at 19:34
  • Is it really that hard to sort them manually? or think another way, your shades could have corresponding colour numbers for file names - from cool to warm tones. Light Blue = 1-0, Blue = 1-2, Dark Blue = 1-3 Purple = 2, 2-1, 2-2 etc. Red = 3 Orange = 4 Then let indesign or similar program layout a grid automatically and see results I have seen a program which converts many tiny thumbnail pictures into larger images - i will have a shimmy around and update later
    – Mark Read
    Commented Apr 27, 2016 at 0:28
  • Update: Google 'photo mosaic' and you will find quite a few different options
    – Mark Read
    Commented Apr 27, 2016 at 0:33

1 Answer 1


I would tackle this in two stages.

1. Sort your images by color.

ImageMagick would be a good option. My answer here has a method for finding the average color of an image. A quick search for 'ImageMagick average color' will find you some more methods with ImageMagick.

Since you are working with product images, I'm assuming the products will be roughly in the same position and size. To get a better representation of the color you can crop the image closer to the product before getting your average color.

There is a post on Stack Overflow about getting the average color of an image with JavaScript.

Color Thief uses JavaScript to extract a color palette and the dominant color of an image so may also be useful (thanks Ryan!).

A search for 'average image color' on your favourite search engine will give you a number of other alternatives.

The specific method and metrics you use for sorting will probably be trial and error, but the basic process will be loop through your images, get the metric you want to sort by, rename your file with a sortable string representation of that metric.

2. Layout your images.

You don't specify how you want to layout your images, but there are a number of options. In Photoshop you can use the preinstalled Contact Sheet. If you don't have Photoshop you can use GIMP and the IGLO - Images Grid LayOut script (untested and is pretty old so may not work, I'm sure you could find something similar though).

If this is for web design, you could use something like masonry, or create grid with regular CSS easily enough.

There is a related post on laying out a grid of images here: Adobe Photoshop: Creating a matrix grid / collage of images


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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