Newbie perl-gimp question
This discussion is connected to the gimp-user-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.
Newbie perl-gimp question | Kate T Yoak | 15 Jan 08:49 |
Newbie perl-gimp question | Owen | 15 Jan 09:21 |
Newbie perl-gimp question | Kate T Yoak | 15 Jan 19:13 |
Newbie perl-gimp question
Hi guys,
I finally got Gimp installed and running for the purpose of writing a web application with image manipulation in perl.
I've been scouring documentation and found a few useful tutorials. But I still don't have a complete picture.
My first script (see below; I am running it from a shell) dies on save (I tried file_gif_save & file_bmp_save. Both fail. What am I doing wrong? What's a good place to find a tutorial that's directed specifically at stand-alone perl-server applications?
Thanks for the help! Kate
================
Here is my sample script:
#!/usr/bin/perl
use Gimp qw(:auto );
use strict;
Gimp::set_trace(TRACE_ALL);
sub do_stuff{
my $size = '100x100';
my $color = "#FFFF00";
my $img = gimp_image_new($size, $size, RGB);
my $layer = gimp_layer_new($img, $size, $size, RGB,
"Layer 1", 100, NORMAL_MODE);
gimp_image_add_layer($img, $layer, -1);
gimp_palette_set_background($color);
my $out = 'out.gif';
# file_gif_save(RUN_NONINTERACTIVE, $img, $layer, $out, $out, 0, 0, 0, 0);
file_bmp_save(RUN_NONINTERACTIVE, $img, $layer, $out, $out);
}
Gimp::on_net(\&do_stuff);
exit main();
Newbie perl-gimp question
Hi guys,
I finally got Gimp installed and running for the purpose of writing a web
application with image manipulation in perl.I've been scouring documentation and found a few useful tutorials. But I
still don't have a complete picture.My first script (see below; I am running it from a shell) dies on save (I
tried file_gif_save & file_bmp_save. Both fail. What am I doing wrong? What's a good place to find a tutorial that's directed specifically at stand-alone perl-server applications?Thanks for the help! Kate
================
Here is my sample script:#!/usr/bin/perl use Gimp qw(:auto );
use strict;Gimp::set_trace(TRACE_ALL); sub do_stuff{
my $size = '100x100';
my $color = "#FFFF00";
my $img = gimp_image_new($size, $size, RGB); my $layer = gimp_layer_new($img, $size, $size, RGB, "Layer 1", 100, NORMAL_MODE); gimp_image_add_layer($img, $layer, -1); gimp_palette_set_background($color); my $out = 'out.gif';
# file_gif_save(RUN_NONINTERACTIVE, $img, $layer, $out, $out, 0, 0, 0, 0);
file_bmp_save(RUN_NONINTERACTIVE, $img, $layer, $out, $out); }
Out of curiosity, I ran that and it gave the following output. (I only added warnings and diagnostics)
================================================================
owen@eight-ten:~/Perlscripts$ perl dostuff
gimp_image_new(
INT32 width=100 "The width of the image (1
) = (
)
================================================================ owen@eight-ten:~/Perlscripts$ ls -l out* -rw-r--r-- 1 owen owen 30054 2009-01-15 19:15 out.gif ================================================================
As you see, all went well and out.gif was produced.
Is your directory for out.gif writable?
Owen
Newbie perl-gimp question
Thanks Owen for trying it! I was able to sort of focus and try figuring out what's going on with my system instead of googling madly for "what the hell am I doing wrong with gimp?" :-)
I haven't figured out *everything* that was going wrong yet. But I think there were two separate issues: one is, the server never got a chance to initialize its directories, so it couldn't write the output. When I killed the server, the bmp file wrote correctly! And once I added conversion to an indexed format, the gif was created!!! I am so happy, I don't know what to do with myself.
Well, there is one thing I can do, I suppose - figure out how to set up the overall environment.
I'll post it as a separate question, though.
Thanks again! Kate
-----Original Message-----
From: Owen [mailto:rcook@pcug.org.au] Sent: Thursday, January 15, 2009 12:22 AM To: Kate T Yoak
Cc: gimp-user@lists.xcf.berkeley.edu Subject: Re: [Gimp-user] Newbie perl-gimp questionHi guys,
I finally got Gimp installed and running for the purpose of
writing a
web application with image manipulation in perl.
I've been scouring documentation and found a few useful
tutorials. But
I still don't have a complete picture.
My first script (see below; I am running it from a shell)
dies on save
(I tried file_gif_save & file_bmp_save. Both fail. What am I doing wrong? What's a good place to find a tutorial that's directed specifically at stand-alone perl-server applications?
Thanks for the help! Kate
================
Here is my sample script:#!/usr/bin/perl use Gimp qw(:auto );
use strict;Gimp::set_trace(TRACE_ALL); sub do_stuff{
my $size = '100x100';
my $color = "#FFFF00";
my $img = gimp_image_new($size, $size, RGB); my $layer = gimp_layer_new($img, $size, $size, RGB, "Layer 1", 100, NORMAL_MODE); gimp_image_add_layer($img, $layer, -1); gimp_palette_set_background($color); my $out = 'out.gif';
# file_gif_save(RUN_NONINTERACTIVE, $img, $layer, $out,$out, 0, 0,
0, 0);
file_bmp_save(RUN_NONINTERACTIVE, $img, $layer, $out, $out); }Out of curiosity, I ran that and it gave the following output. (I only added warnings and diagnostics)
================================================================
owen@eight-ten:~/Perlscripts$ perl dostuff gimp_image_new(
INT32 width=100 "The width of the image (1 ) = (
)================================================================ owen@eight-ten:~/Perlscripts$ ls -l out* -rw-r--r-- 1 owen owen 30054 2009-01-15 19:15 out.gif ================================================================
As you see, all went well and out.gif was produced.
Is your directory for out.gif writable?
Owen