Package bar :: Package rec :: Module thumbnail :: Class Thumbnail
[hide private]
[frames] | no frames]

Class Thumbnail


An extension of PIL.Image class - a method to generate a thumbnail of image has been added.

Instance Methods [hide private]
 
getthumbnail(self, (sizex, sizey)=(256, 160), padding=10, background=(0, 0, 0, 0))
Return the thumbnail of image.

Inherited from PIL.Image.Image: __getattr__, __init__, __repr__, convert, copy, crop, draft, filter, fromstring, getbands, getbbox, getcolors, getdata, getextrema, getim, getpalette, getpixel, getprojection, histogram, load, offset, paste, point, putalpha, putdata, putpalette, putpixel, quantize, resize, rotate, save, seek, show, split, tell, thumbnail, tobitmap, tostring, transform, transpose, verify

Inherited from PIL.Image.Image (private): _copy, _dump, _expand, _makeself, _new

Class Methods [hide private]
 
open(cls, *args, **kwargs)
Because PIL.Image code is written in a messy way this method is necessary to load Thumbnail instance from file.
Class Variables [hide private]

Inherited from PIL.Image.Image: format, format_description

Method Details [hide private]

open(cls, *args, **kwargs)
Class Method

 

Because PIL.Image code is written in a messy way this method is necessary to load Thumbnail instance from file.

#Piotrek: to raczej nie następi :) The code might become unstable when PIL.Image.Image class implementation changes.

getthumbnail(self, (sizex, sizey)=(256, 160), padding=10, background=(0, 0, 0, 0))

 

Return the thumbnail of image.

Parameters:
  • (sizex, sizey) - size of desired thumbnail (without padding)
  • padding (int) - size of padding
  • background ([int, int, int, int]) - background colour in RGBA

Note: the colour of left top pixel is considered to be the background colour

To Do: mode recognition - if alpha chanel is present, use it to recognize background pixels