[totem/gnome-2-32] Make it possible to use --raw along with --size



commit 09fa20a52d1fef46acc3328cc99aae32fcf644b7
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Sep 9 13:14:22 2010 +0100

    Make it possible to use --raw along with --size
    
    So that you can save a thumbnail of a video at a particular
    size, with no borders, but still with resizing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=621802

 src/totem-video-thumbnailer.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/totem-video-thumbnailer.c b/src/totem-video-thumbnailer.c
index 0112a7e..bc98539 100644
--- a/src/totem-video-thumbnailer.c
+++ b/src/totem-video-thumbnailer.c
@@ -61,10 +61,11 @@
 #define GALLERY_MIN 3				/* minimum number of screenshots in a gallery */
 #define GALLERY_MAX 30				/* maximum number of screenshots in a gallery */
 #define GALLERY_HEADER_HEIGHT 66		/* header height (in pixels) for the gallery */
+#define DEFAULT_OUTPUT_SIZE 128
 
 static gboolean jpeg_output = FALSE;
 static gboolean raw_output = FALSE;
-static gboolean output_size = 128;
+static int output_size = -1;
 static gboolean time_limit = TRUE;
 static gboolean verbose = FALSE;
 static gboolean print_progress = FALSE;
@@ -321,10 +322,12 @@ save_pixbuf (GdkPixbuf *pixbuf, const char *path,
 	height = gdk_pixbuf_get_height (pixbuf);
 	width = gdk_pixbuf_get_width (pixbuf);
 
-	/* If we're outputting a gallery or a raw image, don't scale the
-	 * pixbuf or add borders */
-	if (gallery != -1 || raw_output)
+	/* If we're outputting a gallery or a raw image without a size,
+	 * don't scale the pixbuf or add borders */
+	if (gallery != -1 || (raw_output != FALSE && size == -1))
 		with_holes = g_object_ref (pixbuf);
+	else if (raw_output != FALSE)
+		with_holes = scale_pixbuf (pixbuf, size, TRUE);
 	else
 		with_holes = scale_pixbuf (pixbuf, size, is_still);
 
@@ -818,6 +821,9 @@ int main (int argc, char *argv[])
 		g_log_set_always_fatal (fatal_mask);
 	}
 
+	if (raw_output == FALSE && output_size == -1)
+		output_size = DEFAULT_OUTPUT_SIZE;
+
 	if (filenames == NULL || g_strv_length (filenames) != 2 ||
 	    (second_index != -1 && gallery != -1) ||
 	    (print_progress == TRUE && verbose == TRUE)) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]