thumbnailer icon indicating copy to clipboard operation
thumbnailer copied to clipboard

File thumbnailing tool and Ruby library

Description

This package Thumbnailer' comes with a library called thumbnailer' and a program called `thumbnailer'.

The thumbnailer library uses external thumbnailing programs to create an image of wanted size from a given file. Supported output formats are PNG and JPEG.

As my own use for the thumbnailer is as a source of mipmapped textures, the default behaviour is to create a full-size thumbnail. E.g. if you have a 3039x2014 camera raw, you'll get a 3039x2014 jpeg or png out. For PDFs and videos, the default size is 2048px on the longest side.

Usage

create a full-size jpeg thumbnail

$ thumbnailer foo.png foo.jpg $ thumbnailer bar.avi foo.jpg

create a png thumbnail that's scaled to fit in a 1024x1024 square

$ thumbnailer -s 1024 foo.pdf foo_thumb.png

irb> require 'thumbnailer'

fit the jpg inside a 256x256 square

irb> Thumbnailer.thumbnail("foo.png", "foo_thumb.jpg", 256)

page five of the pdf

irb> Thumbnailer.thumbnail("bar.pdf", "bar_thumb.png", 2048, 5)

take the main thumbnail at 30 seconds into the video

irb> Thumbnailer.thumbnail("qux.avi", "qux_thumb.jpg", 1024, 30)

List of supported formats

Images Most image formats. PSDs probably not too accurately.

Successfully tested:
  jpg, png, gif, svg,
  orf, nef, dng, crw, arw, raf, pef, cr2,
  tif, xpm, ppm, tga, pcx, bmp,
  psd

Uses image icon:
  xcf

Uses default icon:
  ai, exr

Videos Anything mplayer / ffmpeg can play.

Successfully tested:
  mkv, flv, avi, mpg, mov, wmv, ogg

Audio Anything mplayer can play.

The audio thumbnailing system is a wee bit peculiar. It relies
on a Tcl/Tk app to create a waveform and spectrogram of the audio.

Successfully tested:
  mp3, wav, m4a, flac, ra, ogg, wma

Uses audio icon:
  ape

Documents The document thumbnailer first converts the document into a PDF, then thumbnails the PDF. The PDF conversion requires ooffice for office documents.

The HTML thumbnailer uses GtkMozEmbed.

Successfully tested:
  pdf, html, ps, ps.gz, txt, sxi, odp, ppt, doc, xls

Uses default icon:
  chm
  

Others Thumbnailer uses a mimetype-specific icon from its icons-directory. If there's an SVG icon, the SVG icon will be used. Otherwise a PNG icon will be used.

Successfully tested:
  directory, bz2, rar, tar.gz, ttf

Uses default icon:
  sis, torrent, rb

Requirements

  • Ruby 1.8

  • Metadata library for Ruby http://github.com/kig/metadata/tree/master

  • Tons of image converter programs and shared-mime-info. http://freedesktop.org/wiki/Software/shared-mime-info List of debian packages: inkscape xvfb openoffice.org python-uno libimlib2-ruby netpbm paps gs-common imagemagick mplayer ffmpeg libsnack2 poppler-utils (v0.6 or later, http://poppler.freedesktop.org/)

  • You need the latest version of dcraw to handle some camera raw images. http://cybercom.net/~dcoffin/dcraw/

  • You need unoconv for thumbnailing office documents: http://dag.wieers.com/home-made/unoconv/

Install

De-compress archive and enter its top directory. Then type:

($ su) # ruby setup.rb

These simple step installs this program under the default location of Ruby libraries. You can also install files into your favorite directory by supplying setup.rb some options. Try "ruby setup.rb --help".

License

GPL v3

Ilmari Heikkinen <ilmari.heikkinen gmail com>