Hi,
I've come across a little known module
which makes a really nice image viewer
based on gtk. It has mouse-click-zoom
and mouse-pan. Very cool.
First you need to have the Gtk and
Gtk-perl modules installed.
Then you need to get the image-viewer
c lib for gtk from
gtk-image-viewer
There are two versions there, 1 for
gtk, and 1 for gtk2. Get the 0.15 version,
as it is the only one the perl module works
with so far. Install it. You may getting
a problem with libtool, but just comment out
the section in the libtool script which checks version.
Then you get the perl module from the above site,
and put it within your Gtk-perl module directory.
Make it. I ran into some trouble here, but maybe it's
because of my SuSE setup. I had to:
1. copy in the gdk,gtk, and gdk-pixbuf includes from
/usr/local/include and /opt/gnome etc.
2 Then recompile twice after moving the .o files into
/build and /xs
If you made it this far, great.
Here is a sample script, which opens up files that
gtk recognizes. The zoom and pan are worth it. :-)
#!/usr/bin/perl
######################################################################
+
# image viewing application with mouse zoom and pan
######################################################################
+
use Gtk;
use Gtk::ImageViewer;
init Gtk;
init Gtk::Gdk::Rgb;
init Gtk::Gdk::Pixbuf;
init Gtk::ImageViewer;
if(@ARGV<1){print "Usage: imageview file\n";exit}
$window = Gtk::Widget->new("GtkWindow",
-type => "-toplevel",
-title => "Image viewer",
-delete_event => sub { print exit Gtk; }
);
$image = Gtk::Widget->new("GtkImageViewer",
-parent => $window,
);
$file = shift;
$pb = new_from_file Gtk::Gdk::Pixbuf($file);
$image->set_image($pb);
$window->show_all();
main Gtk;