[f-spot/rubenv-gsoc-2009: 40/86] Downscale thumbnails before saving.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot/rubenv-gsoc-2009: 40/86] Downscale thumbnails before saving.
- Date: Sun, 23 May 2010 12:35:18 +0000 (UTC)
commit 3f40b411acae723639a3c4d03fec048b1e0001c4
Author: Ruben Vermeersch <ruben savanne be>
Date: Thu Jul 30 11:57:01 2009 +0200
Downscale thumbnails before saving.
src/Loaders/GdkImageLoader.cs | 3 ++-
src/Loaders/LibrawImageLoader.cs | 3 ++-
src/ThumbnailGenerator.cs | 5 +++++
3 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/Loaders/GdkImageLoader.cs b/src/Loaders/GdkImageLoader.cs
index e206972..2cf01b7 100644
--- a/src/Loaders/GdkImageLoader.cs
+++ b/src/Loaders/GdkImageLoader.cs
@@ -187,7 +187,8 @@ namespace FSpot.Loaders {
// for the next call to generate it (see the loop in DoLoad).
if (!ThumbnailFactory.ThumbnailExists (uri)) {
if (ItemsCompleted.Contains (ImageLoaderItem.Large)) {
- ThumbnailFactory.SaveThumbnail (Pixbuf, uri);
+ using (Pixbuf scaled = PixbufUtils.ScaleToMaxSize (Pixbuf, 256, 256, false))
+ ThumbnailFactory.SaveThumbnail (scaled, uri);
} else {
ItemsRequested |= ImageLoaderItem.Large;
return;
diff --git a/src/Loaders/LibrawImageLoader.cs b/src/Loaders/LibrawImageLoader.cs
index 11d13b9..7a82137 100644
--- a/src/Loaders/LibrawImageLoader.cs
+++ b/src/Loaders/LibrawImageLoader.cs
@@ -153,7 +153,8 @@ namespace FSpot.Loaders {
// for the next call to generate it (see the loop in DoLoad).
if (!ThumbnailFactory.ThumbnailExists (uri)) {
if (ItemsCompleted.Contains (ImageLoaderItem.Large)) {
- ThumbnailFactory.SaveThumbnail (Large, uri);
+ using (Pixbuf scaled = PixbufUtils.ScaleToMaxSize (large, 256, 256, false))
+ ThumbnailFactory.SaveThumbnail (scaled, uri);
} else {
ItemsRequested |= ImageLoaderItem.Large;
return;
diff --git a/src/ThumbnailGenerator.cs b/src/ThumbnailGenerator.cs
index e4d87a4..c0a5ce1 100644
--- a/src/ThumbnailGenerator.cs
+++ b/src/ThumbnailGenerator.cs
@@ -10,6 +10,7 @@
using System;
using System.IO;
using FSpot.Utils;
+using FSpot.Loaders;
using FSpot.Platform;
using Mono.Unix.Native;
@@ -33,6 +34,10 @@ namespace FSpot {
using (ImageFile img = ImageFile.Create (uri)) {
thumb = img.Load (256, 256);
}
+ using (IImageLoader loader = ImageLoader.Create (uri)) {
+ loader.Load (ImageLoaderItem.Thumbnail);
+ thumb = loader.Thumbnail;
+ }
if (thumb == null)
return null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]