efl.ethumb.Ethumb
Class¶
- class efl.ethumb.Ethumb¶
Bases:
object
Ethumb thumbnail generator.
New in version 1.17.
Use this class to generate thumbnails in the local process.
See also
EthumbClient
to generate thumbnails using a server (recommended).- delete()¶
Delete the underlying C object.
Note
You MUST call this function when you don’t need the object anymore, as it will free all internal used resources.
- document_page¶
The page number to thumbnail in paged documents.
- Type
int
- exists()¶
Test if the thumbnail already exists.
- Returns
True
if thumbnail exists,False
otherwise
- file¶
The file to thumbnail.
This is a tuple of 2 strings:
path
andkey
.path
: Is the file to use.key
: If path allows storing multiple resources in a single file (EET or Edje for instance), this is the name used to locate the right resource inside the file.For convenience you can also assign a single string value (
path
), ignoring the key.- Type
str or (str, str)
- Raises
RuntimeError – on failure setting the property
- file_free()¶
Reset the source file information.
- frame¶
The optional edje file used to generate a frame around the thumbnail
This can be used to simulate frames (wood, polaroid, etc) in the generated thumbnails.
- Type
(str, str, str): (theme_file, group_name, swallow_name)
- Raises
RuntimeError – on failure setting the property
- generate(func, *args, **kargs)¶
Generate the thumbnail.
Thumbnail generation is asynchronous and depend on ecore main loop running. Given function will be called back with generation status if True is returned by this call. If False is returned, given function will not be called.
Existing thumbnails will be overwritten with this call. Check if they already exist with
exists()
before calling.- Parameters
func –
function to call on generation completion, even if failed or succeeded. Signature is:
func(Ethumb, success, *args, **kargs)
with success being
True
for successful generation orFalse
on failure.- Returns
True
on success andFalse
on failure- Raises
TypeError – if func is not callable.
- thumb_aspect¶
The aspect ratio policy.
When the source and thumbnail aspect ratios don’t match, this policy sets how to adapt from the former to the latter: resize keeping source aspect ratio, resize ignoring it or crop.
- Type
- thumb_category¶
The thumbnails category
Category sub directory to store thumbnail. Default is either “normal” or “large” for FDO compliant thumbnails or
WIDTHxHEIGHT-ASPECT[-FRAMED]-FORMAT
. It can be a string or None to use auto generated names.- Type
str
- thumb_compress¶
The thumbnail compression rate.
Value from 0 to 9, default is 9. The effect depends on the format being used, JPEG will not use it.
- Type
int
- thumb_crop_align¶
Crop alignment in use.
- Parameters
x – horizontal alignment. 0.0 means left side will be visible or right side is being lost. 1.0 means right side will be visible or left side is being lost. 0.5 means just center is visible, both sides will be lost. Default is 0.5.
y – vertical alignment. 0.0 is top visible, 1.0 is bottom visible, 0.5 is center visible. Default is 0.5
- Type
(float x, float y)
- thumb_dir_path¶
Destination folder for the thumbnails.
This is the base folder, a category folder is added to this path as a sub directory. Default is
~/.thumbnails
- Type
str
- thumb_fdo¶
Set a standard FDO thumbnail size
This is a preset to provide freedesktop.org (fdo) standard compliant thumbnails. That is, files are stored as JPEG under ~/.thumbnails/SIZE, with size being either normal (128x128) or large (256x256).
- Type
Ethumb_Thumb_FDO_Size writeonly
- thumb_format¶
The fileformat for the thumbnails.
Thumbnails are compressed; possible formats are PNG, JPEG and EET.
- Type
- thumb_orientation¶
The thumbnail rotation or flip.
- thumb_path¶
The complete path of the generated thumbnail.
This is a tuple of 2 strings:
path
andkey
.path
: Is the complete file path.key
: If path allows storing multiple resources in a single file (EET or Edje for instance), this is the name used to locate the right resource inside the file.For convenience you can also assign a single string value (
path
), ignoring the key.- Type
str or (str, str)
- thumb_quality¶
The thumbnail compression quality.
Value from 0 to 100, default is 80. The effect depends on the format being used, PNG will not use it.
- Type
int
- thumb_size¶
The size of thumbnails.
- Type
(int width, int height)
- video_fps¶
The thumbnail framerate.
Default to 10.
- Type
int
- video_interval¶
The video frame interval, in seconds.
This is useful for animated thumbnail and will define skip time before going to the next frame.
Note
that video backends might not be able to precisely skip that amount as it will depend on various factors, including video encoding.
- Type
float
- video_ntimes¶
The number of times the video loops (if applicable).
- Type
int
- video_start¶
The start point for video thumbnails.
- Type
float (from 0.0 to 1.0)
- video_time¶
The video time (duration) in seconds.
- Type
float