Saving a pixmap which is larger than visible screen size
- From: zentara <zentara1 sbcglobal net>
- To: gtk-list gnome org
- Subject: Saving a pixmap which is larger than visible screen size
- Date: Sat, 28 Oct 2006 12:38:22 -0400
Hi,
First, I use Perl/Gtk2 but I thought I would ask here,
since it seems to be a more informed and active list.
I have been trying to figure this out for awhile, and I am
wondering if it is even possible to do.
Basically what I have, is a DrawingArea that is
2400 X 400. Then I put a pixmap (of same size)
onto it, for persistence. Then I place this into
a ScrolledWindow.
I then write lines to it ( 2 points at a time), like a 24-hour
strip chart recorder. It all works fine, except where I would
like to save the entire 2400x400 area.
My 2 failed methods are below. The both run, but they only
seem to correctly capture the visible portion of the ScrolledWindow,
and make an incorrect 2400 X 400 jpg out of it. Like 4 identical
images side-by-side..... not a full 2400 pixel width.
So is there a way, to save a huge pixmap to file, when the pixmap
is not entirely visible on the screen. ( I'm sort of looking for the
equivalent of Tk's "bbox all" to capture an entire canvas).
Using the normal method, (in Perl)
#########################################################
# create blank pixbuf to hold the image
my $gdkpixbuf = Gtk2::Gdk::Pixbuf->new ('rgb',0, 8, 2400, 400);
$gdkpixbuf->get_from_drawable ($area->window,
undef, 0, 0, 0, 0, 2400, 400);
#only jpeg and png is supported !!!! it's 'jpeg', not 'jpg'
$gdkpixbuf->save ("$0.jpg", 'jpeg', quality => 100);
########################################################
Trying with ImageMagick by using the X id of the DrawingArea
##########################################################
my $xid = $area->window->get_xid;
my $blob = `import -window $xid jpg:`;
my $output = Image::Magick->new(magick=>'jpg');
$output->BlobToImage( $blob );
$output->Write( $0.'.jpg');
############################################################3
Thanks for any pointers.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]