Passing variable to Perl Gimp script via command line

  • Thread starter Frederik Vanrenterghem
  • Start date
F

Frederik Vanrenterghem

The script below creates a quarter of a circle. I'd like to invoke it from
the shell command line, passing a value for $circle_color

Example: ./create_quarter_circle_ul.pl 0 136 0 -o /tmp/test.png

The problem is: I don't know how to change the hardcoded value for
$circle_color. I tried using @ARGV like this:

my @circle_color = (@ARGV[0],@ARGV[1],@ARGV[2]);
gimp_palette_set_background(\@circle_color);

but I'm getting following error messages:

Use of uninitialized value in array dereference at
/usr/share/perl5/Gimp/Fu.pm line 217. Use of uninitialized value in
numeric eq (==) at /usr/share/perl5/Gimp/Fu.pm line 218.

Any ideas? If yes, please CC me on the reply. Here's the full script:

#!/usr/bin/perl
-w

use Gimp qw( :auto );
use Gimp::Fu;

sub website_quarter_circle_ul {
my $width=16;
my $height=$width;
my ($image,$layer);
my $circle_color = [0,136,0];
my $webpage_color = [255,255,255];

gimp_palette_set_background($circle_color);

$image = gimp_image_new($width, $height, RGB); $layer =
gimp_layer_new($image, $width, $height, RGBA_IMAGE, "Button", 100,
NORMAL_MODE);

gimp_image_add_layer($image, $layer, 0);
gimp_edit_clear($layer);
gimp_ellipse_select($image,-0*$height, -0*$width, $width*2,
$height*2, 0, 1, 0, 0.5);
gimp_bucket_fill($layer, BG_BUCKET_FILL, NORMAL_MODE, 100, 0, 0, 5,
5);
gimp_selection_invert($image);
gimp_palette_set_background($webpage_color);
gimp_bucket_fill($layer, BG_BUCKET_FILL, NORMAL_MODE, 100, 0, 0,
5, 5);
gimp_selection_none($image);
gimp_convert_indexed($image, 0, 0, 8,0,0, ""); return $image;
}
register
"website_quarter_circle_ul", # fill in name
"Create Website Toolbar upperleft corner button", # a small description
"A script to generate a quarter circle", # a help text
"Frederik Vanrenterghem", # Your name
"", # Your copyright
"2002-10-21", # Date
"<Toolbox>/Xtns/Perl-Fu/Website/CreateQuarterCircleUL", # menu path
"*", # Image types [
],
\&website_quarter_circle_ul;
exit main()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top