RSS/Atom feed Twitter
Site is read-only, email is disabled

Gimp perl Help

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

Gimp perl Help Hakeem Ogunleye 08 Nov 18:48
  Gimp perl Help Marc) (A.) (Lehmann 09 Nov 22:48
Hakeem Ogunleye
2002-11-08 18:48:35 UTC (over 21 years ago)

Gimp perl Help

Hi,

I'm a newbie to Gimp. I'm trying to use perl scripts to run gimp. The scripts run when i execute it form the command line but when i run it from a browser it doesn't work. the error_log shows: "[Fri Nov 08 12:21:57 2002] [error] [client 127.0.0.1] protocol error (1) at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Gimp/Net.pm line 66."

I have searched the newsgroups and found that this problem is quite common but no one has provided a solution. Does any one have any ideas as to how i can solve this problem?

I have included my script in this mail if it helps. I look forward to your assistence.

Thanks Hakeem

#!/usr/bin/perl

#include the modules necessary to interface with gimp use Gimp qw(:auto);
use Gimp::Fu;
use Gimp::Net;
use CGI;
Gimp::set_trace(TRACE_ALL); # Enable trace output

#tell browser what output format to expect print "Content-type:text/html\n\n";

print ), "\n";

#parse the data posted from the form into thier respcted names read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair); $value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $FORM{$name} = $value;
}

$infile = "/var/www/inimg/"; $outfile = "/var/www/outimg/";
$infile = $infile . "car.gif";
$outfile = $outfile . "car_out.gif";

print "infile, $infile";

#Register extension to gimp register("", "","","","","","","*","",\&embed);

exit main();

sub embed{ print "\ninfile got here, $infile"; $img = gimp_file_load($infile,$infile); $drawable = gimp_image_flatten($img); # in case of layers file_png_save($img,$drawable,"$outfile","$outfile",0,9,0,0,0,0,0); print <
Image name: $FORM{'image'}
Output name: $FORM{'output_img'}
Alpha value: $FORM{'alpha'}
K_ey: $FORM{'key'}
L_ength:$FORM{'length'}

EndHTML

return (); }

__________________

Marc) (A.) (Lehmann
2002-11-09 22:48:35 UTC (over 21 years ago)

Gimp perl Help

On Fri, Nov 08, 2002 at 05:48:35PM +0000, Hakeem Ogunleye wrote:

scripts run when i execute it form the command line but when i run it from a browser it doesn't work. the error_log shows:

Have you tried ./scriptname -v? that will most likely tell you that gimp can't open the display.

Make sure your script has access to a valid DISPLAY (e.g. set $ENV{DISPLAY} ina BEGIN block), e.g. by running an Xserver (Xvfb works nicely).

I have searched the newsgroups and found that this problem is quite common but no one has provided a solution.

Maybe search any gimp mailinglist archives, write a FAQ and thus help others who will, no doubt, have this problem in the future ;->