[pitivi] medialibrary: Create the image thumbnail out of the image
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] medialibrary: Create the image thumbnail out of the image
- Date: Sun, 22 Jan 2017 16:07:39 +0000 (UTC)
commit 8b7d7a8b88a782e1e54d62adf75c2858b3131dc8
Author: Suhas Nayak <suhas2go gmail com>
Date: Sun Jan 22 18:06:26 2017 +0530
medialibrary: Create the image thumbnail out of the image
Previously, thumbnails for images were simply
falling back to image-x-generic
Fixes T7668
Reviewed-by: Alex Băluț <alexandru balut gmail com>
Differential Revision: https://phabricator.freedesktop.org/D1618
pitivi/medialibrary.py | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index f996410..9d63401 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -213,7 +213,22 @@ class AssetThumbnail(Loggable):
small_thumb, large_thumb = self.__get_thumbnails_from_xdg_cache(real_uri)
if not small_thumb:
if self.__asset.is_image():
- small_thumb, large_thumb = self.__get_icons("image-x-generic")
+ path = Gst.uri_get_location(real_uri)
+ try:
+ pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)
+ width = pixbuf.props.width
+ height = pixbuf.props.height
+ small_thumb = pixbuf.scale_simple(
+ SMALL_THUMB_WIDTH,
+ SMALL_THUMB_WIDTH * height / width,
+ GdkPixbuf.InterpType.BILINEAR)
+ large_thumb = pixbuf.scale_simple(
+ LARGE_THUMB_WIDTH,
+ LARGE_THUMB_WIDTH * height / width,
+ GdkPixbuf.InterpType.BILINEAR)
+ except GLib.Error as error:
+ self.debug("Failed loading thumbnail because: %s", error)
+ small_thumb, large_thumb = self.__get_icons("image-x-generic")
else:
# Build or reuse a ThumbnailCache.
thumb_cache = ThumbnailCache.get(self.__asset)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]