A simple image resizer using Dragonfly, Sinatra and a few beers.

This app is meant to be a tool for creating thumbnails. You can adjust the width and height along with a Gravity specified with any image url on the interewebz. There is no database backend so no need to worry about *SQL backends. The cache-control headers, imagemagick binary paths and encryption key is configurable in the application config.

Sample image

Thumby does not store any of the images, it will always fetch the image from the requested url every time, so you should think about tossing varnish or some other caching teir in front of this. This was on purpose so if you needed to refresh the image from origin.


In config/ copy thumby.yaml-sample to thumby.yaml.

:preview_server: http://localhost:4567
  - 'thumby.com'
  - 'thumby.net'
  :convert_command: /usr/local/bin/convert
  :identify_command: /usr/local/bin/identify
  :cache_duration: 86400
  :encryption_key: CHANGE_THIS_KEY
  :encryption_iv:  CHANGE_THIS_TOO
  :gif_mode:  single    # single or animated.  single will select the first frame in a gif.
  :blur_mode: disabled
  :max_size:  2000


That is just used to link the splash page to

Creating Thumbnails?

Copy + Paste the image url from the customer into the URL input field. Input a size that you would like to have in the following format, <width>x<height>. Then select a Gravity to pull the image one direction or another. "Center" is the default.

You can also select:

Sample image 2

URL Format

For those who care the url for generating the thumbnail is as follows.

http://thumby.example.com/t/<size>/<Gravity>/?url=<Customer's image url>

A new feature added is to leave out the Gravity in the url. This will tell Thumby to use Center Gravity unless the image is a portrait, then in which case will set the Gravity North.

http://thumby.example.com/t/<size>/?url=<Customer's image url>

Url-safe base64 encoded url's using '-' instead of '+' and '_' instead of '/'.


Url-safe base64 encoded AES128 encrypted string (That's a mouth full!) with a salt parameter. The client making this call would require the same crypto key that is set in the thumby.yaml config under :encryption_key.


What's this built from?


Jarrett Irons / jarrett@gravity.com