Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  GIMP::UTIL (3)

.ds Aq ’


Gimp::Util - Handy routines for Gimp-Perl users



 use Gimp;
 use Gimp::Util;


Gimp-Perl is nice, but when you have to write everytime 10 lines just to get some simple functions done, it very quickly becomes tedious :-/

This module tries to define some functions that aim to automate frequently used tasks, i.e. its a sort of catch-all-bag for (possibly) useful macro functions. If you want to add a function just mail the author of the Gimp-Perl extension (see below).

In Gimp-Perl (but not in Gimp as seen by the enduser) it is possible to have layers that are NOT attached to an image. This is, IMHO a bad idea, you end up with them and the user cannot see them or delete them. So we always attach our created layers to an image here, too avoid memory leaks and debugging times.

These functions try to preserve the current settings like colors, but not all do.

These functions can also be handled in exactly the same way as PDB-Functions, i.e. the (hypothetical) function gimp_image_xyzzy can be called as $image->xyzzy, if the module is available.

The need to explicitly use Gimp::Util will go away in the future.


get_state (), set_state state get_state returns a scalar representing most of gimps global state (at the moment foreground colour, background colour, active gradient, pattern and brush). The state can later be restored by a call to set_state. This is ideal for library functions such as the ones used here, at least when it includes more state in the future.
layer_create image,name,color,pos create a colored layer, insert into image and return layer
text_draw image,layer,text,font,size,fgcolor Create a colored text, draw over a background, add to img, ret img.
image_create_text text,font,size,fgcolor,bgcolor Create an image, add colored text layer on a background layer, return img.
layer_add_layer_as_mask image,layer,layermask Take a layer and add it as a mask to another layer, return mask.
gimp_image_layertype $alpha returns the corresponding layer type for an image, alpha controls wether the layer type is with alpha or not. Example: imagetype: RGB -> RGB_IMAGE (or RGBA_IMAGE).
gimp_layer2imagetype $layertype returns the corresponding layer type for an image, alpha controls wether the layer type is with alpha or not. Example: imagetype: RGB -> RGB_IMAGE (or RGBA_IMAGE).
$image->add_new_layer($index,$fill_type,$alpha) creates a new layer and adds it at position $index (default 0) to the image, after filling it with gimp_drawable_fill $fill_type (default BG_IMAGE_FILL). If $alpha is non-zero (default 1), the new layer has alpha. Makes up a name based on the 2nd-level caller filename and line.
$image->set_visible(@layers), $image->set_invisible(@layers) mark the given layers visible (invisible) and all others invisible (visible).


Various, version 1.000 written mainly by Tels ( The author of the Gimp-Perl extension (contact him to include new functions) is Marc Lehmann <>
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 UTIL (3) 2014-06-30

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.