Ssimsort

Requires : RMagick

Install ssimsort :

gem install ssimsort

Use ssim as an executable :

$ ssim <INPUT>, <OUTPUT>, <TOLERANCE>

#Tolerance is a number between 0.0 and 1.0 that defines how similar the images you want to sort will be, 1.0 being the exact same image.