An intelligent image thumbnailer in C++, using libJPEG and some magic.
C++ Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
Makefile
Readme.md
fastcrop.cpp
smartcrop.cpp
smartcrop.rb
timeme.cpp
timeme.h

Readme.md

SmartCrop

by Peter Sobot (psobot.com) on August 26, 2012. Licensed under MIT.


SmartCrop is a smart JPEG thumbnailing algorithm based on entropy measurements of a sliding window. Based off an algorithm by Michael Macias, SmartCrop was first implemented in Ruby back in April 2012. This solution, however, was dog-slow. (On the order of ~2 seconds per image processed!)

This repo contains three versions of the same basic program:

  • smartcrop.rb, the original Ruby script using RMagick
  • fastcrop, using libJPEG, literally 50 times faster than the Ruby version.
  • smartcrop, using Magick++, which is roughly 6x faster than the Ruby.

Check out the blog post on comparing the three methods.


General Usage

Just make, then run ./smartcrop or ./fastcrop (or ruby smartcrop.rb):

SmartCrop by Peter Sobot
------------------------
Usage: ./smartcrop [-o output_dir] [-d date_from] input_file input_file ...
       Default output directory is the current directory.
       Default date from is forever ago.