> 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) ================================================================ o...@eight-ten:~/Perlscripts$ perl dostuff gimp_image_new( INT32 width=100 "The width of the image (1 <= width <= 262144)" INT32 height=100 "The height of the image (1 <= height <= 262144)" INT32 type=0 "The type of image { RGB (0), GRAY (1), INDEXED (2) }" ) = ( IMAGE image=1 "The ID of the newly created image" ) gimp_layer_new( IMAGE image=1 "The image to which to add the layer" INT32 width=100 "The layer width (1 <= width <= 262144)" INT32 height=100 "The layer height (1 <= height <= 262144)" INT32 type=0 "The layer type { RGB-IMAGE (0), RGBA-IMAGE (1), GRAY-IMAGE (2), GRAYA-IMAGE (3), INDEXED-IMAGE (4), INDEXEDA-IMAGE (5) }" STRING name="Layer 1" "The layer name" FLOAT opacity=100.000000 "The layer opacity (0 <= opacity <= 100)" INT32 mode=0 "The layer combination mode { NORMAL-MODE (0), DISSOLVE-MODE (1), BEHIND-MODE (2), MULTIPLY-MODE (3), SCREEN-MODE (4), OVERLAY-MODE (5), DIFFERENCE-MODE (6), ADDITION-MODE (7), SUBTRACT-MODE (8), DARKEN-ONLY-MODE (9), LIGHTEN-ONLY-MODE (10), HUE-MODE (11), SATURATION-MODE (12), COLOR-MODE (13), VALUE-MODE (14), DIVIDE-MODE (15), DODGE-MODE (16), BURN-MODE (17), HARDLIGHT-MODE (18), SOFTLIGHT-MODE (19), GRAIN-EXTRACT-MODE (20), GRAIN-MERGE-MODE (21), COLOR-ERASE-MODE (22), ERASE-MODE (23), REPLACE-MODE (24), ANTI-ERASE-MODE (25) }" ) = ( LAYER layer=2 "The newly created layer" ) gimp_image_add_layer( IMAGE image=1 "The image" LAYER layer=2 "The layer" INT32 position=-1 "The layer position" ) = ( ) gimp_palette_set_background( COLOR background=[1.000000,1.000000,0.000000,1.000000] "The background color" ) = ( ) file_bmp_save( INT32 run-mode=1 "Interactive, non-interactive" IMAGE image=1 "Input image" DRAWABLE drawable=2 "Drawable to save" STRING filename="out.gif" "The name of the file to save the image in" STRING raw-filename="out.gif" "The name entered" ) = ( ) ================================================================ o...@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 _______________________________________________ Gimp-user mailing list Gimp-user@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user