diff options
author | jimmacfx <jimmacfx@4fa712ea-3c06-0410-9261-c11b4c06c003> | 2005-11-25 22:41:12 +0000 |
---|---|---|
committer | jimmacfx <jimmacfx@4fa712ea-3c06-0410-9261-c11b4c06c003> | 2005-11-25 22:41:12 +0000 |
commit | 763233dc3b53ed8e10abf9c050a26e870bd598e6 (patch) | |
tree | 37fe5cde17aa8ad3fa8ced1a805fad91035aafc7 /convert | |
parent | 47bca6c272ab1bb87748c583682c7aea1c8d337e (diff) | |
download | original-763233dc3b53ed8e10abf9c050a26e870bd598e6.tar.gz original-763233dc3b53ed8e10abf9c050a26e870bd598e6.tar.bz2 |
remove cruft
git-svn-id: https://forgesvn1.novell.com/svn/original/trunk@6 4fa712ea-3c06-0410-9261-c11b4c06c003
Diffstat (limited to 'convert')
-rw-r--r-- | convert/Makefile | 44 | ||||
-rwxr-xr-x | convert/gdk-pixbuf-convert | bin | 15595 -> 0 bytes | |||
-rw-r--r-- | convert/gdk-pixbuf-convert.c | 226 | ||||
-rw-r--r-- | convert/gdk-pixbuf-convert.d | 80 | ||||
-rwxr-xr-x | convert/webgallery-zenity.pl | 160 | ||||
-rwxr-xr-x | convert/webgallery.pl | 154 |
6 files changed, 0 insertions, 664 deletions
diff --git a/convert/Makefile b/convert/Makefile deleted file mode 100644 index e350747..0000000 --- a/convert/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -PREFIX = /usr/local - -GTKCFLAGS = `pkg-config --cflags gtk+-2.0` -GTKLDFLAGS += `pkg-config --libs gtk+-2.0` -GDKPIXBUFCFLAGS = `pkg-config --cflags gdk-pixbuf-2.0` -GDKPIXBUFLDFLAGS += `pkg-config --libs gdk-pixbuf-2.0` - -CPPFLAGS = $(GTKCFLAGS) -D_GNU_SOURCE -ifeq ($(DEBUG),yes) -CFLAGS += -O2 -g -LDFLAGS = -g #-lefence -else -CFLAGS += -Os -fomit-frame-pointer -endif -CFLAGS += -Wall -CPPFLAGS += -DPACKAGE=\"$(PACKAGE)\" -DPREFIX=\"$(PREFIX)\" -DPACKAGE_LOCALE_DIR=\"$(PREFIX)/share/locale\" -CFLAGS += -MD - -MEMBERS = gdk-pixbuf-convert -LIB_MEMBERS = - -OBJS = $(patsubst %,%.o,$(MEMBERS)) -SOURCES = $(patsubst %,%.c,$(MEMBERS) $(LIB_MEMBERS)) -LIB_OBJS = $(patsubst %,%.o,$(LIB_MEMBERS)) -LIB_SOURCES = $(patsubst %,%.c,$(LIB_MEMBERS)) - -DEPS = $(patsubst %,%.d,$(MEMBERS) $(LIB_MEMBERS)) - - -all: gdk-pixbuf-convert - -gdk-pixbuf-convert: $(OBJS) - $(CC) -o $@ $^ $(GDKPIXBUFCFLAGS) $(GDKPIXBUFLDFLAGS) $(LDFLAGS) -L. - -clean: - rm -f $(MEMBERS) $(OBJS) $(DEPS) - -install: all - mkdir -p $(PREFIX)/bin - install -s $(MEMBERS) $(PREFIX)/bin/ - -uninstall: - $(RM) $(PREFIX)/bin/$(MEMBERS) - diff --git a/convert/gdk-pixbuf-convert b/convert/gdk-pixbuf-convert Binary files differdeleted file mode 100755 index d6943b1..0000000 --- a/convert/gdk-pixbuf-convert +++ /dev/null diff --git a/convert/gdk-pixbuf-convert.c b/convert/gdk-pixbuf-convert.c deleted file mode 100644 index 2bdbeca..0000000 --- a/convert/gdk-pixbuf-convert.c +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* - * gdk-pixbuf-convert.c gdk pixbuf replacement for convert geometry commands - * - * Copyright (C) 2003 Ximian Inc. - * - * Author: Larry Ewing <lewing@ximian.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - * build with - * gcc `pkg-config --cflags gdk-pixbuf-2.0` gdk-pixbuf-convert.c -o gdk-pixbuf-convert `pkg-config --libs gdk-pixbuf-2.0` - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <glib-object.h> - -#define d(x) x - -typedef enum { - SAVE_JPG, - SAVE_PNG -} OutputType; - -GdkPixbuf * -scale (GdkPixbuf *src, char *geom) -{ - GdkPixbuf *dest = NULL; - char *s, *e; - guint w; - guint h; - guint src_w, dest_w; - guint src_h, dest_h; - double scale_w = 1.0; - double scale_h = 1.0; - gboolean force = FALSE; - - src_w = gdk_pixbuf_get_width (src); - src_h = gdk_pixbuf_get_height (src); - - /* d(printf ("%d %d ", src_w, src_h);) */ - - s = e = geom; - - w = strtol (s, &e, 10); - /* d(printf ("%d ", w);) */ - if (e != s) { - scale_w = w / (double)src_w; - } else { - w = 100; - } - - - if (*e == 'x') - e++; - else - return NULL; - - s = e; - - h = strtol (s, &e, 10); - /* d(printf ("%d ", h);) */ - if (e != s) { - scale_h = h / (double)src_h; - } else { - h = 100; - } - - if (*e == '%') { - scale_h = h / 100.0; - scale_w = w / 100.0; - e++; - } - - /* d(printf ("%f %f\n", scale_w, scale_h);) */ - - while (*e) { - switch (*e) { - case '!': - force = TRUE; - break; - case '>': - if (scale_w >= 1.0 && scale_h >= 1.0) - scale_w = scale_h = 1.0; - break; - case '<': - if (scale_w < 1.0 || scale_h <= 1.0) - scale_w = scale_h = 1.0; - break; - default: - break; - } - e++; - } - - if (!force) { - /* Keep aspect ratio */ - scale_w = scale_h = MIN (scale_h, scale_w); - } - - dest_w = (int)(src_w * scale_w + 0.5); - dest_h = (int)(src_h * scale_h + 0.5); - - /* printf ("%dx%d\n", dest_w, dest_h); */ - - /* dest = gdk_pixbuf_scale_simple (src, dest_w, dest_h, GDK_INTERP_BILINEAR);*/ - dest = gdk_pixbuf_scale_simple (src, dest_w, dest_h, GDK_INTERP_HYPER); - - return dest; -} - -OutputType -get_filetype (char *filename) -{ - gint len = strlen (filename); - - if (len > 4 && g_ascii_strncasecmp (filename + len - 4, ".png", 4)== 0) - return SAVE_PNG; - else - return SAVE_JPG; -} - -int -convert (char *geom, char *quality, char *sfile, char *dfile) -{ - GdkPixbuf *src; - GdkPixbuf *dest; - GError *error = NULL; - - src = gdk_pixbuf_new_from_file (sfile, &error); - - if (!src) { - fprintf (stderr, "Unable to open input file"); - return 1; - } - - if (geom) { - dest = scale (src, geom); - } else { - dest = src; - g_object_ref (dest); - } - - if (!dest) - return 1; - - unlink (dfile); - if (get_filetype (dfile) == SAVE_JPG) - gdk_pixbuf_save (dest, dfile, "jpeg", &error, - "quality", quality, NULL); - else - gdk_pixbuf_save (dest, dfile, "png", &error, NULL); - - g_object_unref (src); - g_object_unref (dest); - - if (error) { - return 1; - } - - return 0; -} - -int -main (int argc, char **argv) -{ - char *dfile; - char *sfile; - char *geom = NULL; - char *quality = "100"; - - g_type_init (); - - if (argc > 4) { - int i = 1; - if (!g_ascii_strcasecmp (argv[i], "-geometry")) { - i++; - geom = argv[i++]; - if (argc < 5) - goto usage; - } - if (!g_ascii_strcasecmp (argv[i], "-quality")) { - i++; - quality = argv[i++]; - if (argc < 7) - goto usage; - if ((atoi(quality) < 0) || (atoi(quality) > 100)) { - g_print ("Value for '-quality' must be in range 0-100!\n"); - goto usage; - } - } - sfile = argv[i++]; - dfile = argv[i++]; - } else { - goto usage; - } - - return convert (geom, quality, sfile, dfile); - - usage: - g_print ("Usage:\n"); - g_print (" gdk-pixbuf-convert -geometry <X>x<Y> [-quality <0-100>] <input> <output>\n"); - g_print ("\n"); - g_print ("Example:\n"); - g_print (" gdk-pixbuf-convert -geometry 120x120 -quality 75 foo.jpg bar.jpg\n"); - exit (2); -} diff --git a/convert/gdk-pixbuf-convert.d b/convert/gdk-pixbuf-convert.d deleted file mode 100644 index f0e1e76..0000000 --- a/convert/gdk-pixbuf-convert.d +++ /dev/null @@ -1,80 +0,0 @@ -gdk-pixbuf-convert.o: gdk-pixbuf-convert.c /usr/include/stdio.h \ - /usr/include/features.h /usr/include/sys/cdefs.h \ - /usr/include/gnu/stubs.h \ - /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h \ - /usr/include/bits/types.h /usr/include/bits/wordsize.h \ - /usr/include/bits/typesizes.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ - /usr/include/gconv.h \ - /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ - /usr/include/stdlib.h /usr/include/bits/waitflags.h \ - /usr/include/bits/waitstatus.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/xlocale.h \ - /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ - /usr/include/bits/select.h /usr/include/bits/sigset.h \ - /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \ - /usr/include/alloca.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/getopt.h \ - /usr/include/string.h /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf.h \ - /usr/include/glib-2.0/glib.h /usr/include/glib-2.0/glib/galloca.h \ - /usr/include/glib-2.0/glib/gtypes.h \ - /usr/lib/glib-2.0/include/glibconfig.h \ - /usr/include/glib-2.0/glib/gmacros.h \ - /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/limits.h \ - /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/float.h \ - /usr/include/glib-2.0/glib/garray.h \ - /usr/include/glib-2.0/glib/gasyncqueue.h \ - /usr/include/glib-2.0/glib/gthread.h \ - /usr/include/glib-2.0/glib/gerror.h /usr/include/glib-2.0/glib/gquark.h \ - /usr/include/glib-2.0/glib/gbacktrace.h \ - /usr/include/glib-2.0/glib/gcache.h /usr/include/glib-2.0/glib/glist.h \ - /usr/include/glib-2.0/glib/gmem.h \ - /usr/include/glib-2.0/glib/gcompletion.h \ - /usr/include/glib-2.0/glib/gconvert.h \ - /usr/include/glib-2.0/glib/gdataset.h \ - /usr/include/glib-2.0/glib/gdate.h /usr/include/glib-2.0/glib/gdir.h \ - /usr/include/glib-2.0/glib/gfileutils.h \ - /usr/include/glib-2.0/glib/ghash.h /usr/include/glib-2.0/glib/ghook.h \ - /usr/include/glib-2.0/glib/giochannel.h \ - /usr/include/glib-2.0/glib/gmain.h /usr/include/glib-2.0/glib/gslist.h \ - /usr/include/glib-2.0/glib/gstring.h \ - /usr/include/glib-2.0/glib/gunicode.h \ - /usr/include/glib-2.0/glib/gmarkup.h \ - /usr/include/glib-2.0/glib/gmessages.h \ - /usr/include/glib-2.0/glib/gnode.h \ - /usr/include/glib-2.0/glib/gpattern.h \ - /usr/include/glib-2.0/glib/gprimes.h \ - /usr/include/glib-2.0/glib/gqsort.h /usr/include/glib-2.0/glib/gqueue.h \ - /usr/include/glib-2.0/glib/grand.h /usr/include/glib-2.0/glib/grel.h \ - /usr/include/glib-2.0/glib/gscanner.h \ - /usr/include/glib-2.0/glib/gshell.h /usr/include/glib-2.0/glib/gspawn.h \ - /usr/include/glib-2.0/glib/gstrfuncs.h \ - /usr/include/glib-2.0/glib/gthreadpool.h \ - /usr/include/glib-2.0/glib/gtimer.h /usr/include/glib-2.0/glib/gtree.h \ - /usr/include/glib-2.0/glib/gutils.h \ - /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-features.h \ - /usr/include/glib-2.0/glib-object.h \ - /usr/include/glib-2.0/gobject/gboxed.h \ - /usr/include/glib-2.0/gobject/gtype.h \ - /usr/include/glib-2.0/gobject/genums.h \ - /usr/include/glib-2.0/gobject/gobject.h \ - /usr/include/glib-2.0/gobject/gvalue.h \ - /usr/include/glib-2.0/gobject/gparam.h \ - /usr/include/glib-2.0/gobject/gclosure.h \ - /usr/include/glib-2.0/gobject/gsignal.h \ - /usr/include/glib-2.0/gobject/gmarshal.h \ - /usr/include/glib-2.0/gobject/gparamspecs.h \ - /usr/include/glib-2.0/gobject/gsourceclosure.h \ - /usr/include/glib-2.0/gobject/gtypemodule.h \ - /usr/include/glib-2.0/gobject/gtypeplugin.h \ - /usr/include/glib-2.0/gobject/gvaluearray.h \ - /usr/include/glib-2.0/gobject/gvaluetypes.h \ - /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-loader.h \ - /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-enum-types.h diff --git a/convert/webgallery-zenity.pl b/convert/webgallery-zenity.pl deleted file mode 100755 index a6377d0..0000000 --- a/convert/webgallery-zenity.pl +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/perl -w - -# little script to generate image galleries for use with original PHP backend -# uses Gnome's zenity for user dialogs -# uses gdk-pixbuf-convert if available, otherwise convert (from ImageMagick) -# (c) 2003-2004 Jakub 'jimmac' Steiner, (c) 2003-2004 Colin Marquardt -# based on webgallery.pl by Tuomas Kuosmanen - -use strict; -use warnings; -use FileHandle; - -my $num_of_args = scalar @ARGV; - -if (!@ARGV or ($num_of_args == 0)) { - exec("zenity --error --title \"\" --text \"No args\n\nYou have to select images to work on.\""); - exit; -} - -my $GdkPixbufConvert = "gdk-pixbuf-convert"; -my $Convert = "convert"; -my $dir = "web-gallery"; - - -# try to find a scaler program -my $scaler; -$scaler = `which $GdkPixbufConvert`; -if ($scaler eq "") { - $scaler = `which $Convert`; -} -if ($scaler eq "") { - exec("zenity --error --title \"Giving Up\" --text \"No scaling program\n\nYou need to have '$GdkPixbufConvert' or '$Convert' available.\""); - exit; -} -chomp $scaler; - -my @args = sort(@ARGV); -my $NumOfIncrements = 5; # 5 increments per file (as we are - # expecting to create 5 files for each - # image) -my $increment = 100 / ($num_of_args * $NumOfIncrements); -my $progress=0; -my $reply=""; - -sub make_dirs { - my $ErrMsg; - unless (-d "$dir") { - mkdir("./$dir") or - $ErrMsg .= "Could not create './$dir'!\n"; - } - unless (-d "$dir/thumbs") { - mkdir("./$dir/thumbs") or - $ErrMsg .= "Could not create './$dir/thumbs'!\n"; - } - unless (-d "$dir/lq") { - mkdir("./$dir/lq") or - $ErrMsg .= "Could not create './$dir/lq'!\n"; - } - unless (-d "$dir/mq") { - mkdir("./$dir/mq") or - $ErrMsg .= "Could not create './$dir/mq'!\n"; - } - unless (-d "$dir/hq") { - mkdir("./$dir/hq") or - $ErrMsg .= "Could not create './$dir/hq'!\n"; - } - unless (-d "$dir/comments") { - mkdir("./$dir/comments") or - $ErrMsg .= "Could not create './$dir/comments'!\n"; - } - unless (-d "$dir/zip") { - mkdir("./$dir/zip") or - $ErrMsg .= "Could not create './$dir/zip'!\n"; - } - if ($ErrMsg ne "") { - exec("zenity --error --title \"Giving Up\" --text \"Fatal Error\n\n$ErrMsg\""); - die "Errors occurred:\n$ErrMsg"; - } -} -make_dirs(); - -# ------------------------------------------------------------------------ -open(PROGRESS,"| zenity --progress --auto-close --title=\"Scaling\" \\ - --text=\"Scaling images, please wait\""); -PROGRESS->autoflush(1); - -my $i=1; -my $SetDirDate = 0; -foreach my $arg (@args) { - if (-d $arg) { # argument is a directory, skip it - $progress += ($increment * $NumOfIncrements); - print PROGRESS "$progress\n"; - next; - } - my $FileType = `file "$arg"`; - unless ($FileType =~ /image data/i) { # check for valid file type - # maybe check for JPEG and PNG explicitly? - #print $FileType; - $progress += ($increment * $NumOfIncrements); - print PROGRESS "$progress\n"; - next; - } - if ($SetDirDate == 0) { # we are looking at the first image - $SetDirDate = (stat $arg)[9]; # get mtime - if ($SetDirDate > 0) { - # (can also return -1 if strange mtime, don't use this - # time stamp then) - # set mtime of gallery directory to the one of the first - # image file: - $reply .= `touch -r "$arg" $dir`; - print "Setting mtime of $dir to $SetDirDate\n"; - } else { - # give it another try the next time around: - $SetDirDate = 0; - } - } - # thumbnails - $reply .= `$scaler -geometry 120x120 -quality 60 "$arg" $dir/thumbs/img-$i\.jpg 2>&1`; - $progress += $increment; - print PROGRESS "$progress\n"; - # LQ size - $reply .= `$scaler -geometry 640x480 -quality 75 "$arg" $dir/lq/img-$i\.jpg 2>&1`; - $progress += $increment; - print PROGRESS "$progress\n"; - # MQ size - $reply .= `$scaler -geometry 800x600 -quality 75 "$arg" $dir/mq/img-$i\.jpg 2>&1`; - $progress += $increment; - print PROGRESS "$progress\n"; - # HQ size (just copy the original) - $reply .= `cp "$arg" $dir/hq/img-$i\.jpg 2>&1`; - $progress += $increment; - print PROGRESS "$progress\n"; - # comment - open(COMM, ">$dir/comments/$i\.txt"); - print(COMM "<span>image $i</span>\n"); - close(COMM); - $progress += $increment; - print PROGRESS "$progress\n"; - $i++; - - # an error occurred: - if ($reply ne "") { - print PROGRESS "100\n"; - close(PROGRESS); - exec("zenity --error --title \"Giving Up\" --text \"Fatal Error\n\n$reply\""); - die("Error while scaling"); - } -} -print PROGRESS "100\n"; -close(PROGRESS); - -# ------------------------------------------------------------------------ -open(PROGRESS, "| zenity --progress --pulsate --auto-close \\ ---title \"Compressing\" --text \"Zipping images\""); -PROGRESS->autoflush(1); -print PROGRESS "1"; -system("zip -R $dir/zip/mq.zip $dir/mq/*.jpg"); -system("zip -R $dir/zip/hq.zip $dir/hq/*.jpg"); -print PROGRESS "100\n"; -close(PROGRESS); diff --git a/convert/webgallery.pl b/convert/webgallery.pl deleted file mode 100755 index d8a7ce7..0000000 --- a/convert/webgallery.pl +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/perl -w -# -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# # -# Web Gallery script for Nautilus - Depends on "original" web backend # -# for displaying the gallery. # -# # -# Written in perl because I suck more with sh scripting. # -# Also needs gnome-utils for gdialog. # -# # -# Hacked together by Tuomas Kuosmanen <tigert@ximian.com> # -# Tweaked to use NetPBM by Jakub Steiner <jimmac@ximian.com> # -# Released under the GPL license. # -# # -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - -die "No files to convert" unless @ARGV; - -use Gtk; -init Gtk; - -@files = sort(@ARGV); - -my $dir = "web-gallery"; - -sub make_dirs { - - unless (-d "$dir") { - mkdir("./$dir") or die "Aargh.\n"; - } - unless (-d "$dir/thumbs") { - mkdir("./$dir/thumbs") or die "Aargh.\n"; - } - unless (-d "$dir/lq") { - mkdir("./$dir/lq") or die "Aargh.\n"; - } - unless (-d "$dir/mq") { - mkdir("./$dir/mq") or die "Aargh.\n"; - } - unless (-d "$dir/hq") { - mkdir("./$dir/hq") or die "Aargh.\n"; - } - unless (-d "$dir/comments") { - mkdir("./$dir/comments") or die "Aargh.\n"; - } -} - -sub make_gallery_fake { - my $foo = shift; - print ("PARAM: $foo\n"); - sleep 1; -} - - -$w = new Gtk::Window; -$label = new Gtk::Label(' Web Gallery generation in progress... '); -$pbar = new Gtk::ProgressBar; -$vb = new Gtk::VBox(0, 0); -$b = new Gtk::Button('Cancel'); -$w->add($vb); -$vb->add($label); -$vb->add($pbar); -$vb->add($b); - -$b->signal_connect('clicked', sub {Gtk->exit(0)}); -$w->signal_connect('destroy', sub {Gtk->exit(0)}); - -$w->show_all(); -$i = 0; -$pbar->update($i); - -@files = sort(@ARGV); -$num_of_files = scalar @files; -$increment = 1 / ( 5 * $num_of_files ); -$i = 1; -$progress = 0; - -make_dirs(); -#read nautilus metafile if available -open(METAXML, "./.nautilus-metafile.xml") or print("no metafile"); -@meta_xml = <METAXML>; -close(METAXML); - - -foreach $file (@files) { - - $pbar->update($progress); - $pbar->set_show_text(1); - $pbar->set_format_string("$i of $num_of_files"); - $progress += $increment; - while (Gtk->events_pending) { - Gtk->main_iteration; - } - - # do the stuff, collect error messages to a variable. - #$reply=`convert -geometry 120x120 -colors 64 -dither $file $dir/thumbs/img-$i\.png 2>&1`; - $reply=`convert -geometry 120x120 $file $dir/thumbs/img-$i\.jpg 2>&1`; - #$reply =`jpegtopnm $file | pnmscale -xysize 120 120 | ppmquant -floyd 16 | pnmtopng -interlace -compression 9 > $dir/thumbs/img-$i\.png 2>&1`; - - $pbar->update($progress); - $progress += $increment; - while (Gtk->events_pending) { - Gtk->main_iteration; - } - - $reply = $reply . `convert -geometry 640x640 $file $dir/lq/img-$i.jpg 2>&1`; - #$reply = $reply . `jpegtopnm $file | pnmscale -xysize 640 640 | ppmtojpeg --quality 80 --progressive > $dir/lq/img-$i.jpg 2>&1`; - - $pbar->update($progress); - $progress += $increment; - while (Gtk->events_pending) { - Gtk->main_iteration; - } - - $reply = $reply . `convert -geometry 800x800 $file $dir/mq/img-$i.jpg 2>&1`; - #$reply = $reply . `jpegtopnm $file | pnmscale -xysize 800 800 | ppmtojpeg --quality 80 --progressive > $dir/mq/img-$i.jpg 2>&1`; - - $pbar->update($progress); - $progress += $increment; - while (Gtk->events_pending) { - Gtk->main_iteration; - } - - $reply = $reply . `cp $file $dir/hq/img-$i.jpg 2>&1`; - - $pbar->update($progress); - $progress += $increment; - while (Gtk->events_pending) { - Gtk->main_iteration; - } - - # comment - open (COMM, ">$dir/comments/$i\.txt"); - print(COMM "<span>image $i: </span>\n"); - #check for comments in the metafile - #maybe using a proper XML parser would make sense in future - foreach $radek (@meta_xml) { - chomp($radek); - if ($radek =~ m/.*name="([^"]*)".*annotation="([^"]*).*"/) { - if ($1 eq $file) { - print(COMM "<span>$2</span>\n"); - } - } - } - close(COMM); - - $i++; - - # print possible error messages - if ($reply ne "") { - print("There was an error message: $reply\n"); - } -} - |