gimp calls in perl
Message-ID:<go7kr9$5su$1@aioe.org>
Subject:
gimp calls in perl
Date:Fri, 27 Feb 2009 03:58:13 +0100
Hi,
I dug up some old rudimentary perl scripts of mine that once got gimp
to manipulate images subsequently included in a generated web page
(via apache as local server). The problem is I "lost it", just can't
make them work anymore.
Now it's gimp-2.6.5, perl-5.8, oss-11.1 and so on. Times have changed
but it seems I still have to get gimp to load perl modules or vice
versa, never knew which way that went exactly. I've installed just
about everything I can think of...
('cpan' bombed, couldn't make)
PDL-2.4.4.tar.gz
(installed ..prerequisite of Gimp-1.211.tar.gz)
Gimp-1.211.tar.gz (shouldn't this be called perl-gimp.xxx?)
(Makefile.PL)
FATAL: unable to deduce plugindir from gimptool script
(find can't come up with /usr/lib/gimp/2.0/plug-ins ???)
perl-Gimp-2.0pre3-4.1.i586.rpm
(installed [Perl::FU a.k.a. Gimp:FU] FU meaning?)
Gimp-2.2pre1.tar.gz
(installed, shouldn't this be called perl-gimp.xxx?)
Gimp-2.6.5-2.1.i586.rpm & dependencies
(installed)
..........but still can't get past errors like
[client 127.0.0.1] gimpit.pl:
Cannot call 'main::gimp_file_load' at this time
Can anyone clarify the necessary steps for me please?
What exactly needs to be installed? Right now I think I have a lot of
stuff aboard that I don't need at all. No problem, it's all done on a
dirty 'test' partition. I just want gimp to respond and execute when
called from perl, I don't need any of this while otherwise explicitly
working with gimp as such, as a user with the gui.
does gimp have to be running? why?
does its fu server have to be running? which one? why?
if so, how can I tell if it's running?
how do I get it all together?
TIA
----------------------------------------------------------
#!/usr/local/bin/perl -w
print"Content-type:text/html\n\n";
# gimpit.pl script to test if gimp will respond
########################################
# remove what isn't needed, add what is
########################################
use Gimp qw (:auto);
use Gimp::Fu;
use Gimp::Net;
use Gimp::Util;
use GD::Image;
###########################
register "", "", "", "", "", "", "<None>", "*", "",
# how to transpose this to 127.0.0.1 without absolute path?
$file1="/srv/www/htdocs/user/filez/source.png";
$rotangle=-238;$radians = 2 * 3.141592654 * $rotangle/360.0;
$image1 = gimp_file_load($file1, $file1);
$layerarray1 = $image1->get_layers;
$image = gimp_image_new(1769,1769, RGB);
$background = $image->layer_new($image->width,
$image->height,RGB_IMAGE,"Background",100, NORMAL_MODE);
$image->add_layer($background, 0);
$layerarray1->edit_copy();
$throwaway1 = $background->edit_paste(0);
$throwaway1->anchor;
$background=gimp_rotate($background,0,$radians);
$final=gimp_image_flatten($image); # reduce visible layers to one.
# save new file (optional)
# how to transpose this to 127.0.0.1 without absolute path?
$targr="/srv/www/htdocs/user/filez/target.png";
file_png_save($image, $final, $targr, $targr, 0,9,0,0,0,0,0); # to
single layer ???
# show the new image (if Gimp & its perl server are up?).
# which IS the 'perl' server?
return $final;
print"<img src=$final>";
exit;
----------------------------------------------------------
Message-ID:<go8t87$4n4$1@aioe.org>
Subject:
Re: gimp calls in perl [resolved, another method]
Date:Fri, 27 Feb 2009 15:27:45 +0100
rsink wrote: > Hi, > ..........but still can't get past errors like > [client 127.0.0.1] gimpit.pl: > Cannot call 'main::gimp_file_load' at this time Fixed as a result of help received on alt.os.linux.suse > > If you have more than one directory (as you indicated), > > you can add another line: > > > > use lib '/path/to/dir'; > > use lib '/path2/to/dir2'; which I did to replace lines like: use Gimp qw (:auto); use Gimp::Fu; use Gimp::Util;
Message-ID:<go7kr9$5su$1@aioe.org>
Subject:
gimp calls in perl
Date:Fri, 27 Feb 2009 03:58:13 +0100
Hi,
I dug up some old rudimentary perl scripts of mine that once got gimp
to manipulate images subsequently included in a generated web page
(via apache as local server). The problem is I "lost it", just can't
make them work anymore.
Now it's gimp-2.6.5, perl-5.8, oss-11.1 and so on. Times have changed
but it seems I still have to get gimp to load perl modules or vice
versa, never knew which way that went exactly. I've installed just
about everything I can think of...
('cpan' bombed, couldn't make)
PDL-2.4.4.tar.gz
(installed ..prerequisite of Gimp-1.211.tar.gz)
Gimp-1.211.tar.gz (shouldn't this be called perl-gimp.xxx?)
(Makefile.PL)
FATAL: unable to deduce plugindir from gimptool script
(find can't come up with /usr/lib/gimp/2.0/plug-ins ???)
perl-Gimp-2.0pre3-4.1.i586.rpm
(installed [Perl::FU a.k.a. Gimp:FU] FU meaning?)
Gimp-2.2pre1.tar.gz
(installed, shouldn't this be called perl-gimp.xxx?)
Gimp-2.6.5-2.1.i586.rpm & dependencies
(installed)
..........but still can't get past errors like
[client 127.0.0.1] gimpit.pl:
Cannot call 'main::gimp_file_load' at this time
Can anyone clarify the necessary steps for me please?
What exactly needs to be installed? Right now I think I have a lot of
stuff aboard that I don't need at all. No problem, it's all done on a
dirty 'test' partition. I just want gimp to respond and execute when
called from perl, I don't need any of this while otherwise explicitly
working with gimp as such, as a user with the gui.
does gimp have to be running? why?
does its fu server have to be running? which one? why?
if so, how can I tell if it's running?
how do I get it all together?
TIA
----------------------------------------------------------
#!/usr/local/bin/perl -w
print"Content-type:text/html\n\n";
# gimpit.pl script to test if gimp will respond
########################################
# remove what isn't needed, add what is
########################################
use Gimp qw (:auto);
use Gimp::Fu;
use Gimp::Net;
use Gimp::Util;
use GD::Image;
###########################
register "", "", "", "", "", "", "<None>", "*", "",
# how to transpose this to 127.0.0.1 without absolute path?
$file1="/srv/www/htdocs/user/filez/source.png";
$rotangle=-238;$radians = 2 * 3.141592654 * $rotangle/360.0;
$image1 = gimp_file_load($file1, $file1);
$layerarray1 = $image1->get_layers;
$image = gimp_image_new(1769,1769, RGB);
$background = $image->layer_new($image->width,
$image->height,RGB_IMAGE,"Background",100, NORMAL_MODE);
$image->add_layer($background, 0);
$layerarray1->edit_copy();
$throwaway1 = $background->edit_paste(0);
$throwaway1->anchor;
$background=gimp_rotate($background,0,$radians);
$final=gimp_image_flatten($image); # reduce visible layers to one.
# save new file (optional)
# how to transpose this to 127.0.0.1 without absolute path?
$targr="/srv/www/htdocs/user/filez/target.png";
file_png_save($image, $final, $targr, $targr, 0,9,0,0,0,0,0); # to
single layer ???
# show the new image (if Gimp & its perl server are up?).
# which IS the 'perl' server?
return $final;
print"<img src=$final>";
exit;
----------------------------------------------------------
Message-ID:<go8t87$4n4$1@aioe.org>
Subject:
Re: gimp calls in perl [resolved, another method]
Date:Fri, 27 Feb 2009 15:27:45 +0100
rsink wrote: > Hi, > ..........but still can't get past errors like > [client 127.0.0.1] gimpit.pl: > Cannot call 'main::gimp_file_load' at this time Fixed as a result of help received on alt.os.linux.suse > > If you have more than one directory (as you indicated), > > you can add another line: > > > > use lib '/path/to/dir'; > > use lib '/path2/to/dir2'; which I did to replace lines like: use Gimp qw (:auto); use Gimp::Fu; use Gimp::Util;



RSS News Feed