| |
- Thumbnailer
-
- GdkPixbufThumbnailer
class Thumbnailer |
|
Base class for programs which generate thumbnails.
The method run() creates the thumbnail for a source file. This
calls the methods get_image(), process_image() and store_image().
process_image() takes the image returned by get_image() and scales it to
the correct dimensions then passes it through post_process_image() (which
does nothing).
You should override the method get_image() to create the image. You can
also override post_process_image() if you wish to work on the scaled
image. |
|
Methods defined here:
- __init__(self, name, fname, use_wdir=False, debug=False)
- Initialise the thumbnailer.
name - name of the program
fname - a string to use in generated temp file names
use_wdir - if true then use a temp directory to store files
debug - if false then suppress most error messages
- get_image(self, inname, rsize)
- Method you must define for your thumbnailer to do anything
- make_working_dir(self)
- Create the temporary directory and change into it.
- post_process_image(self, img, w, h)
- Perform some post-processing on the image.
img - gdk-pixbuf of the image
w - width
h - height
Return: modified image
The default implementation just returns the image unchanged.
- process_image(self, img, rsize)
- Take the raw image and scale it to the correct size.
Returns the result of scaling img and passing it to
post_process_image()
- remove_working_dir(self)
- Remove our temporary directory, after changing back to the
previous one
- report_exception(self)
- Report an exception if debug enabled, otherwise ignore it
- run(self, inname, outname=None, rsize=96)
- Generate the thumbnail from the file
inname - source file
outname - path to store thumbnail image, or None for default location
rsize - maximum size of thumbnail (in either axis)
- store_image(self, img, inname, outname, ow, oh)
- Store the thumbnail image it the correct location, adding
the extra data required by the thumbnail spec.
| |