Passing variable to Perl Gimp script via command line

Discussion in 'Perl Misc' started by Frederik Vanrenterghem, Dec 25, 2003.

  1. 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()
    Frederik Vanrenterghem, Dec 25, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    417
    Gordon Beaton
    May 17, 2005
  2. danilo

    Gimp-Python

    danilo, Aug 21, 2005, in forum: Python
    Replies:
    2
    Views:
    437
    David Trudgett
    Aug 22, 2005
  3. norseman
    Replies:
    0
    Views:
    513
    norseman
    Jun 25, 2009
  4. Jason Dumler

    Ruby-Gimp / Ruby-Gtk2

    Jason Dumler, Oct 12, 2003, in forum: Ruby
    Replies:
    0
    Views:
    78
    Jason Dumler
    Oct 12, 2003
  5. Anthony Roy
    Replies:
    7
    Views:
    208
    A. Sinan Unur
    Mar 4, 2005
Loading...

Share This Page