On Sat, 2009-08-29 at 13:34 -0300, Joao S. O. Bueno wrote:
On Tuesday 25 August 2009, Michael wrote:
Hello,
I'm trying to use a Perl script that makes use of Perl's Gimp module (the
simplified version Gimp::Fu) for Gimp Gimp versions 2.x. (I have GIMP 2.6.2
under OpenSUSE 11.2).
Whenever I try to execute the script from the Filters Perl-Fu menu option
I
get error messages like:
Calling error for procedure 'gimp-procedural-db-proc-info':
Procedure 'gimp-gimp-image-new' not found.
The funny thing is that my procedures are correctly called in the script
('gimp-image-new', 'gimp-layer-new' ...), but somehow a 'gimp' is prepended
here.
Hi Michael --
the sad news is that I haven't heard, in recent years of anyoen amitaining
teh
GIMP-PERL bindings It may very well be that they are in an unusable state.
Maybew someone cna come with more promising news for you - but otherwise, I'd
suggest porting your scripts to gimp-python for the time being.
js
--
I wrote some plug-ins back in February and remember seeing this problem.
I'm using Gimp 2.6.6 on Ubuntu 9.04 with libgimp-perl 2.0.dfsg
+2.2pre1.dfsg-5.
If I remember correctly, this isn't really an error, it's an
informational message that keeps popping alert boxes up. I got around
it by setting the message handler to console while the script was
running and then resetting it to it's previous value on exit.
In case I don't remember correctly here is a Perl-Fu script that runs
under gimp 2.6.6. Feel free to play with it, reuse whatever part you
want or just trace it and watch what happens (uncomment the trace and
start it from a terminal).
drop_shadow.pl
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+$@}'
if 0; # not running under some shell
# create a drop shadow
# and framing it. Derived from drop-shadow.scm
#
# Created by Bill Ferguson b...@moonshinecomputers.com
use Gimp qw(:auto __ N_);
use Gimp::Fu;
#Gimp::set_trace(TRACE_ALL);
sub max {
$_[0] $_[1] ? $_[0] : $_[1];
}
sub min {
$_[0] $_[1] ? $_[0] : $_[1];
}
sub drop_shadow {
my($img, $drawable, $shadow_transl_x, $shadow_transl_y, $shadow_blur,
$shadow_color, $shadow_opacity, $allow_resize) = @_;
my $old_handler = message_get_handler();
message_set_handler(CONSOLE);
my $old_fg = context_get_foreground();
my $old_bg = context_get_background();
eval { $img-undo_group_start };
$shadow_blur = max($shadow_blur, 0);
$shadow_opacity = max(min($shadow_opacity, 100), 0);
my $imgtype = $drawable-type_with_alpha();
my $image_height = $img-height();
my $image_width = $img-width();
my($from_selection, $active_selection, $shadow_layer) = 0;
#
# code goes here
#
my $cur_layer = $img-get_active_layer();
$drawable-layer_add_alpha();
if($img-selection_is_empty()){
$drawable-selection_layer_alpha();
$from_selection = 0;
}
else{
$from_selection = 1;
$active_selection = $img-selection_save();
}
my($not_empty, $x1, $y1, $x2, $y2) = $img-selection_bounds();
my $select_width = $x2 - $x1;
my $select_height = $y2 - $y1;
my $shadow_width = $select_width + ($shadow_blur * 2);
my $shadow_height = $select_height + ($shadow_blur * 2);
my $shadow_offset_x = $x1 - $shadow_blur;
my $shadow_offset_y = $y1 - $shadow_blur;
if($allow_resize){
my $new_image_width = $image_width;
my $new_image_height = $image_height;
my($image_offset_x, $image_offset_y) = 0;
if(($shadow_offset_x + $shadow_transl_x) 0){
$image_offset_x = 0 - ($shadow_offset_x +
$shadow_transl_y);
$shadow_offset_x = 0 - $shadow_transl_x;
$new_image_width += $image_offset_x;
}
if(($shadow_offset_y + $shadow_transl_y) 0){
$image_offset_y = 0 - ($shadow_offset_y +
$shadow_transl_y);
$shadow_offset_y = 0 - $shadow_transl_y;
$new_image_height += $image_offset_y;
}
if(($shadow_width + $shadow_offset_x + $shadow_transl_x)
$new_image_width){
$new_image_width = $shadow_width + $shadow_offset_x +
$shadow_transl_x;
}
if(($shadow_height + $shadow_offset_y + $shadow_transl_y)
$new_image_height){
$new_image_height = $shadow_height + $shadow_offset_y +
$shadow_transl_y;
}
$img-resize($new_image_width, $new_image_height,
$image_offset_x,
$image_offset_y);