|
From: Doug H. <dh...@uc...> - 2002-02-05 01:29:57
|
Hi all: I'm working on a PLplot/PDL interface, primarily for web use.
Has anyone suggested the ability to return an image as a variable
instead of to a file or stream, as the GD (formerly 'Gif-Draw', now PNG
draw) package does?
In my web page (using mason and perl), I'm right now doing something
like this:
<%args>
@size => (500,600)
</%args>
<%init>
$r->content_type('image/png');
my $tmpfile = "/tmp/testxy.png";
my $pl = PDL::Graphics::PLplotOO->new (DEV => "png", FILE => $tmpfile,
PAGESIZE => [@size]);
my $x = random(10);
my $y = $x**2;
$pl->xyplot($x, $y, TYPE => 'POINTS');
$pl->close;
undef $/;
open(IN, $tmpfile);
my $image = <IN>;
close(IN);
</%init>
<%$image%>
I'd like to be able to avoid the temp file and get the image directly
into
a variable, like this:
...
my $image = $pl->close;
...
<%$image%>
When I checked the *PGPLOT* source, this proved well-nigh impossible.
Would it be any easier in PLplot? (I'm in the process of switching from
PGPLOT to PLplot).
Please send any mail to me as I'm not (yet) on the list.
Many thanks for any info or hints,
Doug Hunt
--
dh...@uc...
Software Engineer III, Sometimes Sysadmin
UCAR - COSMIC, Tel. (303) 497-2611
|