layer_apply - Apply a perl expression to every layer of the image
<Image>/Filters/Generic/Apply Perl Expression...
Runs a perl expression for each layer of an image. The perl expression can use the following variables:
The image.
The current drawable (currently always a layer).
The index of the current layer. $i counts from 0 to $n-1, i.e. from top to the bottom of the stack with layer #0 being the top of the stack.
$i
$I counts "backwards", i.e. from $n-1 to 0, so layer 0 is at the bottom.
$I
Similar to $i, but counts from 0 to 1 (inclusive). $p is equivalent to $i/($n-1) and $P is equivalent to $I/($n-1).
$i/($n-1)
$I/($n-1)
The number of layers in the image.
The drawable2 argument, entirely optional and can be used for anything you like.
The following expression will gradually fade out an animation.
$d->brightness_contrast ($P * 127, 0);
This little script can be used to merge two animations, $d2 should point to another animation with the same number of frames (only the image is of concern). It does it by copying each frame of the other animation onto the corresponding frame in the current animation and using DARKEN_MODE to combine the frames. You might want to use other modes or maybe $f-set_opacity(50)> for your animation.
$f-
$i2=$d2->get_image; $l2=($i2->get_layers)[$i]; $i2->selection_all; $l2->edit_copy; $f=$d->edit_paste(0); $f->set_mode(DARKEN_ONLY_MODE); $f->anchor;
[PF_TEXT, "expr", "Perl expression to run for each layer", '$d->gauss_rle($P*100+1,1,1)'], [PF_DRAWABLE, "d2", "Optional extra drawable if your code needs it"],
*
Marc Lehmann <pcg@goof.com>
19990708
Distributed under the same terms as Gimp-Perl.
To install Gimp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gimp
CPAN shell
perl -MCPAN -e shell install Gimp
For more information on module installation, please visit the detailed CPAN module installation guide.