[gimp-perl] Tidy example docs and param descriptions.



commit 96a80c3de4783a75516b86b84aee46582d3592a6
Author: Ed J <edj src gnome org>
Date:   Thu May 1 02:38:39 2014 +0100

    Tidy example docs and param descriptions.

 examples/Perl-Server       |   14 ++
 examples/README            |   47 +-----
 examples/animate_cells     |    2 +-
 examples/billboard         |    8 +-
 examples/blended2          |  110 +++++-------
 examples/blowinout         |  108 +++++-------
 examples/bricks            |    2 +-
 examples/burst             |   52 +++----
 examples/centerguide       |   31 ++--
 examples/colorhtml         |   12 +-
 examples/dataurl           |    6 +-
 examples/ditherize         |   62 +++----
 examples/dust              |   78 ++++-----
 examples/example-net       |   13 +-
 examples/example-oo        |   76 --------
 examples/examples.TODO     |   10 -
 examples/exceptiontest     |    3 +-
 examples/fade-alpha        |    9 +-
 examples/feedback          |   86 ++++++----
 examples/frame_reshuffle   |    2 +-
 examples/gallery           |  414 +++++++++++++++++++++-----------------------
 examples/iland             |  210 +++++++++++------------
 examples/image_tile        |  210 +++++++++-------------
 examples/perlotine         |    6 +-
 examples/pixelmap          |    4 +-
 examples/prep4gif          |    8 +-
 examples/randomart1        |   14 +-
 examples/randomblends      |    2 +-
 examples/selective_sharpen |   84 +++++-----
 examples/sethspin          |   10 +-
 examples/stampify          |  131 ++++++++------
 examples/stamps            |   10 +-
 examples/tex-to-float      |  291 +++++++++++++++----------------
 examples/translogo         |    4 +-
 examples/triangle          |   92 ++++++----
 examples/view3d            |   60 ++++---
 examples/webify            |   10 +-
 examples/xachshadow        |    2 +-
 examples/xachvision        |    4 +-
 examples/yinyang           |    2 +-
 40 files changed, 1045 insertions(+), 1254 deletions(-)
---
diff --git a/examples/Perl-Server b/examples/Perl-Server
index e698bbc..219d955 100755
--- a/examples/Perl-Server
+++ b/examples/Perl-Server
@@ -31,3 +31,17 @@ Gimp::on_query {
 };
 
 exit Gimp::main;
+__END__
+
+=head1 NAME
+
+Perl-Server - enable Gimp-Perl scripts to access running GIMP instance
+via Gimp::Net
+
+=head1 SYNOPSIS
+
+<Image>/Filters/Languages/_Perl/_Server
+
+=head1 DESCRIPTION
+
+Also provides a working example of a GIMP extension in Gimp-Perl.
diff --git a/examples/README b/examples/README
index 4d5d765..d15539f 100644
--- a/examples/README
+++ b/examples/README
@@ -1,45 +1,8 @@
-This file describes a few of the many scripts in the examples/ directory.
+Please read the POD for the scripts in here; either with "perldoc",
+or run them from the command-line and click the "Help" button, or find
+them on the Gimp-Perl CPAN POD docs.
 
-Some links of interest have been added to the bottom as well.
-
-If you want to be added, drop me a note at <sjburges gimp org>.
-
-Each script will contain a licensing statement in it, describing how it may
-be distributed.  A handful are believed to be GPL, but the author hasn't
-been able to be contacted.
-
-Also, most scripts in the examples directory are not described or
-documented here. See their source for more info.
-
-example-fu.pl
-        An example Gimp::Fu script. This shows every widget Gimp::Fu
-       offers, but doesn't do much useful otherwise.
-
-example-oo.pl
-       A small nonsense extension just showing the object-oriented
-       pdb syntax.
-
-example-net.pl
-       a small nonsense extension showing a bare-bones networked script.
-
-webify.pl
-       a small plugin that flattens an image, makes the background
-       transparent, converts it to indexed and then crops it
-       to the right size. Useful to save small & transparent gifs
-       from a higher-quality source. It also features several
-       Gimp::Fu UI-elements.
-
-windify.pl
-       Blows your image in a direction, using the Displace filter.
-
-prep4gif.pl
-       Will create a copy of your image prepared for saving
-       as indexed gif. It will create a border around the non-alpha
-       sections of your image, so it won't look jaggy on a background.
-
-gimp-make-img-map
-       "This program is an automatic way of scaling and tiling lots of
-       images in order to create an index image."
+Other sources of inspiration:
 
 http://www.ualberta.ca/~cwant/gimp/postprocess.html
        Using Gimp-Perl for animation post-processing; some very neat effects
@@ -51,5 +14,3 @@ http://bbgallery.sourceforge.net/
 
 http://imagic.weizmann.ac.il/~dov/gimp/perl-tut-2.0/
        Dov Grobgeld's excellent intro to Gimp-Perl, updated for 2.0
-
-
diff --git a/examples/animate_cells b/examples/animate_cells
index b1aea44..b944a2a 100755
--- a/examples/animate_cells
+++ b/examples/animate_cells
@@ -92,7 +92,7 @@ on top of it which represent your "cells".
 
 =head1 PARAMETERS
 
-  [PF_TOGGLE, "work_on_copy", "", 1]
+  [PF_TOGGLE, "work_on_copy", "Work on copy", 1]
 
 =head1 IMAGE TYPES
 
diff --git a/examples/billboard b/examples/billboard
index 6c11174..087778c 100755
--- a/examples/billboard
+++ b/examples/billboard
@@ -171,12 +171,12 @@ I think it was tigert that suggested this.
 
 =head1 PARAMETERS
 
-  [PF_DRAWABLE, "destination","What drawable to spin to?"],
-  [PF_INT8, "frames", "How many frames to use?", 16],
+  [PF_DRAWABLE, "destination", "What drawable to spin to"],
+  [PF_INT8, "frames", "How many frames to use", 16],
   [PF_COLOR, "background", "What color to use for background if not transparent", 'black'],
   [PF_INT8, "perspective", "How much perspective effect to get", 40],
-  [PF_TOGGLE, "spin_back", "Also spin back?" , 0],
-  [PF_TOGGLE, "convert_indexed", "Convert to indexed?", 1],
+  [PF_TOGGLE, "spin_back", "Also spin back" , 0],
+  [PF_TOGGLE, "convert_indexed", "Convert to indexed", 1],
   [PF_SPINNER, "billboard_slats", "Number of shades", 3, [1,50,1]],
 
 =head1 IMAGE TYPES
diff --git a/examples/blended2 b/examples/blended2
index 2fbf4f0..24e1cdd 100755
--- a/examples/blended2
+++ b/examples/blended2
@@ -7,46 +7,27 @@ use Gimp::Util;
 # Gimp::set_trace(TRACE_ALL);
 
 podregister {
-  # if you specify RGBA as your type, this die is only there for
-  # running it non-interactively
-  $drawable->has_alpha or die "You can't run this script without an ALPHA CHANNEL!!";
-
-  # get release of gimp, so we can be compatible between versions
-  my $gimpversion = Gimp->version;
-  $gimpversion =~ m/^(\d)\.(\d)\.\d/;
-  my $gimpmajor = $1;
-  my $gimpminor = $2;
-  my $api22 = 0; my $api23 = 0;
-
-  if ($gimpmajor == 2 && $gimpminor == 2) { $api22 = 1; }
-  elsif ($gimpmajor == 2 && $gimpminor >= 3) { $api23 = 1; }
-  else {die "Don't know how to handle gimp version $gimpversion with this plugin!\n"};
-
+  die "Must have alpha channel\n" unless $drawable->has_alpha;
   Gimp::Context->push();
-
-  my $img = gimp_image_new (256, 100, RGB_IMAGE);
+  my $new_image = gimp_image_new ($drawable->width,$drawable->height, RGB_IMAGE);
   $drawable->get_image->selection_all;
   $drawable->edit_copy;
   gimp_selection_none ($image);
   if ($rad_tog == 0) {
-         my $bg_layer;
-         $bg_layer=$img->layer_new($drawable->width,$drawable->height,$image->layertype(1), "Background", 
100, NORMAL_MODE);
-         Gimp::Context->set_background ($bg_col);
-         $bg_layer->drawable_fill(BACKGROUND_FILL);
-         $img->insert_layer($bg_layer,0,0);
+    my $bg_layer;
+    $bg_layer=$new_image->layer_new($drawable->width,$drawable->height,$image->layertype(1), "Background", 
100, NORMAL_MODE);
+    Gimp::Context->set_background ($bg_col);
+    $bg_layer->drawable_fill(BACKGROUND_FILL);
+    $new_image->insert_layer($bg_layer,0,0);
   }
-  $img->resize($drawable->width,$drawable->height, 0, 0);
-  my $text1_lay;
-  $text1_lay=$img->layer_new($drawable->width,$drawable->height,$image->layertype(1), "Text -1-", 100, 
NORMAL_MODE);
-  $img->insert_layer($text1_lay,0,-1);
+  my $text1_lay=$new_image->layer_new(
+    $drawable->width,$drawable->height,
+    $image->layertype(1), "Text -1-", 100, NORMAL_MODE
+  );
+  $new_image->insert_layer($text1_lay,0,-1);
   gimp_edit_clear ($text1_lay);
   $text1_lay->edit_paste(0)->floating_sel_anchor;
-  if ($api22) {
-    $text1_lay->set_preserve_trans(1);
-  }
-  elsif ($api23) {
-    $text1_lay->set_lock_alpha(1);
-  }
+  $text1_lay->set_lock_alpha(1);
   Gimp::Context->set_foreground ($bl1);
   Gimp::Context->set_background ($bl2);
   @start = ($text1_lay->width / 2 - 5, 0);
@@ -67,41 +48,33 @@ podregister {
   my $text2_lay;
   $text2_lay=$text1_lay->copy(1);
   $text2_lay->add_alpha;
-  $img->insert_layer($text2_lay, 0, -1);
+  $new_image->insert_layer($text2_lay, 0, -1);
   Gimp::Context->set_background ([255, 255, 255]);
   $text2_lay->edit_fill(BACKGROUND_FILL);
-  if ($api22) {
-    $text1_lay->set_preserve_trans(0);
-    $text2_lay->set_preserve_trans(0);
-  }
-  elsif ($api23) {
-    $text1_lay->set_lock_alpha(0);
-    $text2_lay->set_lock_alpha(0);
-  }
+  $text1_lay->set_lock_alpha(0);
+  $text2_lay->set_lock_alpha(0);
   plug_in_gauss_rle ($text2_lay, 6, 1, 1);
-  plug_in_bump_map ($img, $text1_lay, $text2_lay, 110.0, $elev, $depth, 0, 0, 0, 0, 0, 0, 0);
+  plug_in_bump_map ($new_image, $text1_lay, $text2_lay, 110.0, $elev, $depth, 0, 0, 0, 0, 0, 0, 0);
   $text2_lay->invert;
-  $img->lower_item($text2_lay);
+  $new_image->lower_item($text2_lay);
   $text2_lay->translate(2, 3);
   $text2_lay->set_opacity(75);
+  $new_image->flatten;
   if ($rad_tog == 1) {
-         $img->flatten;
-         gimp_image_convert_indexed ($img, 0, MAKE_PALETTE, 256, 0, 0, "");
-         my $new = gimp_image_get_active_drawable ($img);
-         gimp_layer_add_alpha ($new);
-         gimp_context_set_sample_threshold(55);
-         gimp_context_set_antialias(0);
-         gimp_context_set_feather(0);
-         gimp_context_set_feather_radius(0);
-         gimp_context_set_sample_merged(0);
-         gimp_image_select_color ($img, CHANNEL_OP_ADD, $new, [255, 255, 255]);
-         gimp_edit_clear ($new);
-         gimp_selection_none ($img);
-  } else {
-         $img->flatten;
+    gimp_image_convert_indexed ($new_image, 0, MAKE_PALETTE, 256, 0, 0, "");
+    my $new_layer = gimp_image_get_active_drawable ($new_image);
+    gimp_layer_add_alpha ($new_layer);
+    gimp_context_set_sample_threshold(55);
+    gimp_context_set_antialias(0);
+    gimp_context_set_feather(0);
+    gimp_context_set_feather_radius(0);
+    gimp_context_set_sample_merged(0);
+    gimp_image_select_color ($new_image, CHANNEL_OP_ADD, $new_layer, [255, 255, 255]);
+    gimp_edit_clear ($new_layer);
+    gimp_selection_none ($new_image);
   }
-#      gimp_display_new ($img);
-  ();
+  gimp_display_new ($new_image);
+  $new_image;
 };
 exit main;
 __END__
@@ -116,20 +89,25 @@ make_bevel_logos - A script to get blended beveled logos
 
 =head1 DESCRIPTION
 
-This script will produce a nice blended beveled logo from your alpha
-layer, which must have a black text. You can choose the initial and finals
-colours of the blend, the background, and how to tweak the bevel effect.
-It uses a techinque quite similar to that in the Inner Bevel Logo.
+This script will produce a new image with a blended beveled logo from
+your alpha layer, which must have black text. You can choose the initial
+and final colours of the blend, the background, and how to tweak the
+bevel effect. It uses a technique quite similar to that in the Inner
+Bevel Logo.
 
 =head1 PARAMETERS
 
- [PF_COLOUR    , 'bg_col', "Choose the background colour", [255, 255, 255]],
- [PF_COLOUR    , 'bl1',  "Choose the 1st blend colour", [247, 231, 9]],
- [PF_COLOUR    , 'bl2',   "Choose the 2nd blend colour", [255, 0, 0]],
+ [PF_COLOUR    , 'bg_col', "Background colour", [255, 255, 255]],
+ [PF_COLOUR    , 'bl1',  "1st blend colour", [247, 231, 9]],
+ [PF_COLOUR    , 'bl2',   "2nd blend colour", [255, 0, 0]],
  [PF_SLIDER    , 'elev', "Strength of bevel", 45.00, [0.00, 60.00, 0.50]],
  [PF_SLIDER    , 'depth', "Depth of bevel", 4, [0, 60, 1]],
  [PF_RADIO     , 'rad_tog', "The user's choice", 0, [Background => 0, Transparent => 1]],
 
+=head1 RETURN VALUES
+
+ [PF_IMAGE     , 'image', "Logo"],
+
 =head1 IMAGE TYPES
 
 RGBA
diff --git a/examples/blowinout b/examples/blowinout
index 6e019f0..371db57 100755
--- a/examples/blowinout
+++ b/examples/blowinout
@@ -7,72 +7,60 @@ use strict;
 # Gimp::set_trace(TRACE_CALL);
 
 podregister {
-    # bail out if $drawable isn't a layer
-    die "Not a layer\n" unless $drawable->is_layer;
-    $drawable->become('Gimp::Layer');
-#    print "Starting\n";
-    if( $image->selection_is_empty == 0) { return };
-#    if ($nsteps == 0) return;
-    eval { $image->undo_group_start };
-    Gimp::Context->push();
-    #get the drawable dimensions
-    my $xsize = $drawable->width;
-    my $ysize = $drawable->height;
-
-    # Set background color to 128, for clearing dm
-    Gimp::Context->set_background([128,128,128]);
-
-    # Create a grayscale workspace image for displacement map
-    my $dm = Gimp::Image->new($xsize, $ysize, 1);
-    eval { $dm->undo_group_start };
-    # It needs to have 2 layers
-    my $dmlayer = Gimp::Layer->new($dm, $xsize, $ysize, GRAY_IMAGE, "newlayer",
-        100, NORMAL_MODE);
-    $dm->insert_layer($dmlayer, 0, 0);
-
-    # Create the layers, one-by-one
-    my $i = 1;
-    my $xdist = ($arithmode) ?
-        $i * $distance / $nsteps * -cos($angle * 3.14159 / 180) :
-        $distance ** ($i/$nsteps) * -cos($angle * 3.14159 / 180);
-    my $ydist = ($arithmode) ?
-        $i * $distance / $nsteps * sin($angle * 3.14159 / 180) :
-        $distance ** ($i/$nsteps) * sin($angle * 3.14159 / 180);
+  die "Not a layer\n" unless $drawable->is_layer;
+  $drawable->become('Gimp::Layer');
+  return if $image->selection_is_empty == 0;
+  $image->undo_group_start;
+  Gimp::Context->push();
+  #get the drawable dimensions
+  my $xsize = $drawable->width;
+  my $ysize = $drawable->height;
+
+  Gimp::Context->set_background([128,128,128]);
+
+  # Create a grayscale workspace image for displacement map
+  my $dm = Gimp::Image->new($xsize, $ysize, 1);
+  # It needs to have 2 layers
+  my $dmlayer = Gimp::Layer->new($dm, $xsize, $ysize, GRAY_IMAGE, "newlayer",
+    100, NORMAL_MODE);
+  $dm->insert_layer($dmlayer, 0, 0);
+
+  # Create the layers, one-by-one
+  my $i = 1;
+  my $xdist = ($arithmode) ?
+    $i * $distance / $nsteps * -cos($angle * 3.14159 / 180) :
+    $distance ** ($i/$nsteps) * -cos($angle * 3.14159 / 180);
+  my $ydist = ($arithmode) ?
+    $i * $distance / $nsteps * sin($angle * 3.14159 / 180) :
+    $distance ** ($i/$nsteps) * sin($angle * 3.14159 / 180);
+  $dmlayer->edit_clear;
+  $dmlayer->noisify(0, 255, 255, 255, 0);
+  $dmlayer->levels(0, 0, 255, 1.0, 128, 255);
+  $drawable = $drawable->copy(0);
+  $image->insert_layer($drawable, 0, -1);
+  $drawable->displace($xdist, $ydist, 1, 1, $dmlayer, $dmlayer, 1);
+  $image->lower_item($drawable) if $inmode == 1;
+  for ( $i = 2; $i <= $nsteps; $i++ ) {
+    $xdist = ($arithmode) ?
+      $i * $distance / $nsteps * -cos($angle * 3.14159 / 180) :
+      $distance ** ($i/$nsteps) * -cos($angle * 3.14159 / 180);
+    $ydist = ($arithmode) ?
+      $i * $distance / $nsteps * sin($angle * 3.14159 / 180) :
+      $distance ** ($i/$nsteps) * sin($angle * 3.14159 / 180);
     $dmlayer->edit_clear;
     $dmlayer->noisify(0, 255, 255, 255, 0);
     $dmlayer->levels(0, 0, 255, 1.0, 128, 255);
     $drawable = $drawable->copy(0);
     $image->insert_layer($drawable, 0, -1);
     $drawable->displace($xdist, $ydist, 1, 1, $dmlayer, $dmlayer, 1);
-    if ( $inmode == 1 ) {
-        $image->lower_item($drawable);
-    };
-    for ( $i = 2; $i <= $nsteps; $i++ ) {
-        $xdist = ($arithmode) ?
-            $i * $distance / $nsteps * -cos($angle * 3.14159 / 180) :
-            $distance ** ($i/$nsteps) * -cos($angle * 3.14159 / 180);
-        $ydist = ($arithmode) ?
-            $i * $distance / $nsteps * sin($angle * 3.14159 / 180) :
-            $distance ** ($i/$nsteps) * sin($angle * 3.14159 / 180);
-        $dmlayer->edit_clear;
-        $dmlayer->noisify(0, 255, 255, 255, 0);
-        $dmlayer->levels(0, 0, 255, 1.0, 128, 255);
-       $drawable = $drawable->copy(0);
-       $image->insert_layer($drawable, 0, -1);
-       $drawable->displace($xdist, $ydist, 1, 1, $dmlayer, $dmlayer, 1);
-        if ( $inmode == 1 ) {
-           $image->lower_item($drawable);
-        };
-    }
-
-    eval { $dm->undo_group_end };
-#    gimp_image_remove_layer($dm, $dmlayer);
-#    gimp_image_delete ($dm);
-    Gimp::Context->pop;
-    eval { $image->undo_group_end };
-#    gimp_displays_flush(); unneccessary (and dangerous ;)
-
-    (); # I like smileys ;)
+    $image->lower_item($drawable) if $inmode == 1;
+  }
+
+#  gimp_image_remove_layer($dm, $dmlayer);
+#  gimp_image_delete ($dm);
+  Gimp::Context->pop;
+  $image->undo_group_end;
+  ();
 };
 
 exit main;
diff --git a/examples/bricks b/examples/bricks
index 3e34371..faab759 100755
--- a/examples/bricks
+++ b/examples/bricks
@@ -114,7 +114,7 @@ Generate a brick texture for using in 3d games.
 =head1 PARAMETERS
 
  [PF_PATTERN, "pattern", "Brick pattern", "Leather"],
- [PF_TOGGLE,  "borderpatuse", "Use border pattern?", 0],
+ [PF_TOGGLE,  "borderpatuse", "Use border pattern", 0],
  [PF_PATTERN, "borderpattern", "Border pattern", "Leather"],
  [PF_COLOR,   "color", "Border color", [0.80,0.80,0.80]],
  [PF_SPINNER, "borderwidth", "Border width", 1, [0,1000,1]],
diff --git a/examples/burst b/examples/burst
index 7a934fb..2623b8a 100755
--- a/examples/burst
+++ b/examples/burst
@@ -4,32 +4,24 @@ use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
 # Gimp::set_trace(TRACE_ALL);
+use constant PI => 3.1415926;
 
 # find an equivalent polar value in the range of 0 to 2 pi
-sub find_in_2pi
-{
+sub find_in_2pi {
   my ($ang) = @_;
-  if ($ang < 0)
-    {
-       return ($ang - int($ang/(2*3.1415926))*2*3.1415926 + 2*3.1415926);
-    }
-  return ($ang - int($ang/(2*3.1415926))*2*3.1415926);
+  return $ang - int($ang/(2*PI))*2*PI + 2*PI if $ang < 0;
+  return $ang - int($ang/(2*PI))*2*PI;
 }
 
 podregister {
-    $pi = 3.1415927;
-
     # Special case 360
-    if (abs($arc_angle) == 360)
-      {
+    if (abs($arc_angle) == 360) {
         $end_angle = $start_angle + $arc_angle - abs ($arc_angle/$spokes);
-      }
-    else
-      {
-        $end_angle = $start_angle + $arc_angle;
-      }
+    } else {
+      $end_angle = $start_angle + $arc_angle;
+    }
 
-    eval { $image->undo_group_start };
+    $image->undo_group_start;
 
     Gimp->progress_init("Burst");
     $progress_increment = 1/$spokes;
@@ -58,11 +50,11 @@ podregister {
         # do $spokes worth
         for ($i = 0;
              $i < $spokes;
-            #$angle <$end_angle*$pi/180-0.01;
+            #$angle <$end_angle*PI/180-0.01;
              $i++ )
           {
-            $angle = $i * abs($start_angle-$end_angle)*$pi/($spokes-1)/180;
-            $angle += $start_angle*$pi/180;
+            $angle = $i * abs($start_angle-$end_angle)*PI/($spokes-1)/180;
+            $angle += $start_angle*PI/180;
 
             # use the major/minor axis description of an ellipse:
             # x^2   y^2
@@ -95,13 +87,13 @@ podregister {
             $y_start = sqrt(1/((1/($m*$m*$c*$c))+(1/$d/$d)));
 
             # pick the right solution of the quadratic
-            if ((find_in_2pi($angle) < $pi/2) ||
-                (find_in_2pi($angle) > 3*$pi/2))
+            if ((find_in_2pi($angle) < PI/2) ||
+                (find_in_2pi($angle) > 3*PI/2))
               {
                 $x = -$x;
                 $x_start = -$x_start;
               }
-            if (find_in_2pi($angle) > $pi)
+            if (find_in_2pi($angle) > PI)
               {
                 $y = -$y;
                 $y_start = -$y_start;
@@ -136,8 +128,8 @@ podregister {
              $i < $spokes;
              $i++ )
           {
-            $angle = $i * abs($start_angle-$end_angle)*$pi/($spokes-1)/180;
-            $angle += $start_angle*$pi/180;
+            $angle = $i * abs($start_angle-$end_angle)*PI/($spokes-1)/180;
+            $angle += $start_angle*PI/180;
 
             # get the slope
             $m = sin($angle)/cos($angle);
@@ -165,8 +157,8 @@ podregister {
              }
           # the method of finding points by lines like above makes picking right
           # values kinda icky, as shown by these if statements.
-          if ((find_in_2pi($angle) <= $pi/2) ||
-             (find_in_2pi($angle) > 3*$pi/2))
+          if ((find_in_2pi($angle) <= PI/2) ||
+             (find_in_2pi($angle) > 3*PI/2))
             {
                 $x = -abs($x);
                 $x_start = -abs($x_start);
@@ -177,7 +169,7 @@ podregister {
                 $x_start = abs($x_start);
             }
 
-          if (find_in_2pi($angle) > $pi)
+          if (find_in_2pi($angle) > PI)
             {
               $y = -abs($y);
               $y_start = -abs($y_start);
@@ -204,8 +196,8 @@ podregister {
           Gimp->progress_update($progress);
         }
     }
-  eval { $image->undo_group_end };
-  return();
+  $image->undo_group_end;
+  ();
 };
 
 exit main;
diff --git a/examples/centerguide b/examples/centerguide
index a32639c..754fb4d 100755
--- a/examples/centerguide
+++ b/examples/centerguide
@@ -4,27 +4,18 @@
 # Changed spot that its registered from <Image>/Guides to <Image>/Image/Guides
 # to reduce horizontal clutter on menubar
 
-use Gimp qw(:auto __ N_);
+use Gimp;
 use Gimp::Fu;
 
-podregister
-       sub {
-               my ($image, $drawable, $center) = @_;
-
-               $w = $image->width();
-               $h = $image->height();
-               $hc = int($h/2 + 0.5);
-               $vc = int($w/2 + 0.5);
-
-               if ($center == 1) {
-                       $hc = int(($h / 2.6179) + 0.5);
-               };
-                $image->undo_group_start;
-               $bit_bucket = $image->add_hguide($hc);
-               $bit_bucket = $image->add_vguide($vc);
-               gimp_drawable_update($drawable, 0, 0, $w, $h);
-                $image->undo_group_end;
-       };
+podregister {
+  my $w = $image->width;
+  my $h = $image->height;
+  $image->undo_group_start;
+  $image->add_hguide($center == 1 ? int(($h / 2.6179) + 0.5) : int($h/2 + 0.5));
+  $image->add_vguide(int($w/2 + 0.5));
+  $drawable->update(0, 0, $w, $h);
+  $image->undo_group_end;
+};
 exit main;
 __END__
 
@@ -42,7 +33,7 @@ Physical center = width/2 and height/2; Optical center = the Golden Mean.
 
 =head1 PARAMETERS
 
-  [PF_RADIO, "center", "center", 0, [Physical => 0, Optical => 1] ]
+  [PF_RADIO, "center", "Which center", 0, [Physical => 0, Optical => 1] ]
 
 =head1 IMAGE TYPES
 
diff --git a/examples/colorhtml b/examples/colorhtml
index 55d1e72..36c569a 100755
--- a/examples/colorhtml
+++ b/examples/colorhtml
@@ -149,16 +149,16 @@ and will disturb the current font colour.
 
 =head1 PARAMETERS
 
-  [PF_RADIO,   "character_source", "where to take the characters from", 0,
+  [PF_RADIO,   "character_source", "Where to take characters from", 0,
                [sourcecode => 0, textfile => 1, textblock => 2]],
   [
     PF_FILE,   "characters",
-    "the filename to read or the characters to use", ""
+    "Filename to read or characters to use", ""
   ],
-  [PF_STRING, "font_size", "the html font size (1..7 or -7 .. +7)", 2],
-  [PF_BOOL, "use_css", "use CSS?", 1],
-  [PF_BOOL, "compatible", "html-4.0 compliance?", 1],
-  [PF_BOOL, "closetag", "add closing tag?", 1],
+  [PF_STRING, "font_size", "HTML font size (1..7 or -7 .. +7)", 2, ],
+  [PF_BOOL, "use_css", "Use CSS", 1],
+  [PF_BOOL, "compatible", "HTML-4.0 compliance", 1],
+  [PF_BOOL, "closetag", "Add closing tag", 1],
 
 =head1 IMAGE TYPES
 
diff --git a/examples/dataurl b/examples/dataurl
index 40279e8..1e26852 100755
--- a/examples/dataurl
+++ b/examples/dataurl
@@ -78,9 +78,9 @@ Saves the image as many small tiles using data:-urls.
 
 =head1 PARAMETERS
 
- [PF_SPINNER, "tile_x", "tile width", 32, [0, 8192, 1, 10]],
- [PF_SPINNER, "tile_y", "tile height", 32, [0, 8192, 1, 10]],
- [PF_RADIO, "filetype", "underlying file type", 0,
+ [PF_SPINNER, "tile_x", "Tile width", 32, [0, 8192, 1, 10]],
+ [PF_SPINNER, "tile_y", "Tile height", 32, [0, 8192, 1, 10]],
+ [PF_RADIO, "filetype", "Underlying file type", 0,
     [GIF => 0, JFIF => 1, PNG => 2]],
 
 =head1 IMAGE TYPES
diff --git a/examples/ditherize b/examples/ditherize
index 0b70e9b..788402d 100755
--- a/examples/ditherize
+++ b/examples/ditherize
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 use strict;
-use Gimp qw(:auto);
+use Gimp;
 use Gimp::Fu;
 
 #Gimp::set_trace(TRACE_ALL);
@@ -13,40 +13,32 @@ my %imagetype2layertype = (
 );
 
 podregister {
-#   Gimp::set_trace(-1);
-
-   $drawable->is_layer or die "this plug-in only works for layers";
-
-   $image->undo_group_start;
-
-   # make sure something is selected
-   $drawable->mask_bounds or $image->selection_all;
-
-   my ($x1,$y1,$x2,$y2)=($drawable->mask_bounds)[1..4];
-   my ($w,$h)=($x2-$x1,$y2-$y1);
-
-   my $sel = $image->selection_save;
-   $image->select_rectangle(CHANNEL_OP_REPLACE,$x1,$y1,$w,$h);
-   $drawable->edit_copy;
-   $sel->selection_load;
-   $sel->remove_channel;
-
-   my $copy = new Gimp::Image($w, $h, $image->base_type);
-   $copy->undo_disable;
-   my $draw = new Gimp::Layer($copy, $w, $h,
-                       $imagetype2layertype{$image->base_type},
-                       "temporary layer", 100, NORMAL_MODE);
-   $copy->insert_layer ($draw, 0, 1);
-   $draw->edit_paste(0)->anchor;
-   $copy->convert_indexed ($dither_type, MAKE_PALETTE, $colours, 1, 1, "");
-
-   $draw->edit_copy;
-   $drawable->edit_paste(1)->anchor;
-   $copy->delete;
-
-   $image->undo_group_end;
-
-   ();
+  $drawable->is_layer or die "this plug-in only works for layers";
+  $image->undo_group_start;
+  # make sure something is selected
+  $drawable->mask_bounds or $image->selection_all;
+  my ($x1,$y1,$x2,$y2)=($drawable->mask_bounds)[1..4];
+  my ($w,$h)=($x2-$x1,$y2-$y1);
+  my $sel = $image->selection_save;
+  $image->select_rectangle(CHANNEL_OP_REPLACE,$x1,$y1,$w,$h);
+  $drawable->edit_copy;
+  $sel->selection_load;
+  $sel->remove_channel;
+  my $copy = new Gimp::Image($w, $h, $image->base_type);
+  $copy->undo_disable;
+  my $draw = new Gimp::Layer(
+    $copy, $w, $h,
+    $imagetype2layertype{$image->base_type},
+    "temporary layer", 100, NORMAL_MODE
+  );
+  $copy->insert_layer ($draw, 0, 1);
+  $draw->edit_paste(0)->anchor;
+  $copy->convert_indexed ($dither_type, MAKE_PALETTE, $colours, 1, 1, "");
+  $draw->edit_copy;
+  $drawable->edit_paste(1)->anchor;
+  $copy->delete;
+  $image->undo_group_end;
+  ();
 };
 
 exit main;
diff --git a/examples/dust b/examples/dust
index 338dd5a..86d4f86 100755
--- a/examples/dust
+++ b/examples/dust
@@ -1,8 +1,5 @@
 #!/usr/bin/perl
 
-eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
-    if 0; # not running under some shell
-
 use Gimp;
 use Gimp::Fu;
 use Gimp::Util;
@@ -53,47 +50,34 @@ use Gimp::Util;
 #set_seed 0; use PDL; use PDL::Graphics::PGPLOT; line(pdl(float,map gen_rand, 1..500));
 
 podregister {
-   # Die Parameter werden ganz "normal" �bergeben:
-   my ($image, $layer, $density, $seed, $len) = @_;
-
-   $len *= 0.75;
-
-   set_seed $seed;
-
-   # Gimp::set_trace(TRACE_ALL);
-   my ($w, $h) = ($image->width, $image->height);
-
-   $image->undo_group_start;
-
-   Gimp::Context->push;
-   Gimp::Context->set_foreground("white");
-   my $brush = Gimp->brush_duplicate("Circle (01)");
-   Gimp::Context->set_brush($brush);
-   Gimp::Brushes->set_spacing($brush, 100);
-   Gimp::Context->set_opacity(50);
-   Gimp::Context->set_paint_mode(NORMAL_MODE);
-
-   $layer = $image->add_new_layer (0, TRANSPARENT_FILL, 1);
-   $layer->set_mode (DIFFERENCE_MODE);
-
-   for (1..($w*$h*$density)) {
-      my ($x, $y) = (rand $w, rand $h);
-      my $l = int($len + rand $len);
-      my @c;
-      my $b = 0;
-      for (1..$l) {
-         push @c, $b += 5*(gen_rand-0.5);
-         push @c, $b += 5*(gen_rand-0.5);
-      }
-
-      $layer->paintbrush_default([map { $x+$c[$_], $y+$c[$_+$l] } 0..$l-1]);
-   }
-
-   Gimp::Context->pop;
-
-   $image->undo_group_end;
-
-   ();
+  $length *= 0.75;
+  set_seed $seed;
+  # Gimp::set_trace(TRACE_ALL);
+  my ($w, $h) = ($image->width, $image->height);
+  $image->undo_group_start;
+  Gimp::Context->push;
+  Gimp::Context->set_foreground("white");
+  my $brush = Gimp->brush_duplicate("Circle (01)");
+  Gimp::Context->set_brush($brush);
+  Gimp::Brushes->set_spacing($brush, 100);
+  Gimp::Context->set_opacity(50);
+  Gimp::Context->set_paint_mode(NORMAL_MODE);
+  $drawable = $image->add_new_layer (0, TRANSPARENT_FILL, 1);
+  $drawable->set_mode (DIFFERENCE_MODE);
+  for (1..($w*$h*$density)) {
+    my ($x, $y) = (rand $w, rand $h);
+    my $l = int($length + rand $length);
+    my @c;
+    my $b = 0;
+    for (1..$l) {
+       push @c, $b += 5*(gen_rand-0.5);
+       push @c, $b += 5*(gen_rand-0.5);
+    }
+    $drawable->paintbrush_default([map { $x+$c[$_], $y+$c[$_+$l] } 0..$l-1]);
+  }
+  Gimp::Context->pop;
+  $image->undo_group_end;
+  ();
 };
 
 #register "gen_rand_1f",
@@ -136,9 +120,9 @@ Add the appearance of dust to an image.
 
 =head1 PARAMETERS
 
-  [PF_FLOAT,   'density',      'dust density in dust/pixel',    0.0001],
-  [PF_INT32,   'seed',         'the random seed (0 == unspecified)', 0],
-  [PF_SPINNER, 'length',       'the average dust corn length', 50, [1,300]],
+  [PF_FLOAT,   'density',      'Dust density in dust/pixel',    0.0001],
+  [PF_INT32,   'seed',         'Random seed (0 == unspecified)', 0],
+  [PF_SPINNER, 'length',       'Average dust corn length', 50, [1,300]],
 
 =head1 IMAGE TYPES
 
diff --git a/examples/example-net b/examples/example-net
index 7d6b63d..3170555 100755
--- a/examples/example-net
+++ b/examples/example-net
@@ -1,12 +1,9 @@
 #!/usr/bin/perl
 
-# example for the gimp-perl-server (also called Net-Server)
-
 use Gimp;
 
-# on_lib is called if run through Gimp
 Gimp::on_lib {
-   print STDERR "$0: this script is not intended to be run from within the gimp!\n";
+   die "Not intended to be run from within GIMP!\n";
 };
 
 # on_net is called if connecting to an already open Perl-Server, or if
@@ -35,11 +32,13 @@ Gimp::on_net {
 };
 
 exit main;
+__END__
+
+=head1 NAME
+
+example-net - Demonstrate use of Gimp-Perl "net mode"
 
 =head1 LICENSE
 
 Copyright Marc Lehman.
 Distributed under the same terms as Gimp-Perl.
-
-=cut
-
diff --git a/examples/exceptiontest b/examples/exceptiontest
index b3bb2ad..d55261c 100755
--- a/examples/exceptiontest
+++ b/examples/exceptiontest
@@ -1,6 +1,5 @@
-#!/usr/local/bin/perl -w
+#!/usr/bin/perl -w
 
-use strict;
 use Gimp;
 use Gimp::Fu;
 #BEGIN { $Gimp::verbose = 1; }
diff --git a/examples/fade-alpha b/examples/fade-alpha
index 6b634c2..20b34cb 100755
--- a/examples/fade-alpha
+++ b/examples/fade-alpha
@@ -833,9 +833,9 @@ alpha_fade - Fade the alpha channel of a layer from one side to another
 
 =head1 DESCRIPTION
 
-Rewritten by Ed J to use Gimp::Fu as demo of PF_CUSTOM widget. Original
-by Seth Burgess, inspired by a mailing list question that asked how to do
-exactly what this does, which is fade the alpha from one side to another.
+Inspired by a mailing list question that asked how to do exactly what this
+does, which is fade the alpha from one side to another. Original by Seth
+Burgess, rewritten by Ed J to use Gimp::Fu as demo of PF_CUSTOM widget.
 
 =head1 PARAMETERS
 
@@ -843,8 +843,7 @@ exactly what this does, which is fade the alpha from one side to another.
      my $btnTable = new Gtk2::Table(3,3,1);
      $btnTable->set_border_width(6);
      my $btn = new Gtk2::RadioButton;
-     my $u_direction;
-     my @buttons;
+     my ($u_direction, @buttons);
      for (my $x=0;$x<3;$x++) {
        for (my $y=0;$y<3;$y++) {
         my $dir = $x*3 + $y;
diff --git a/examples/feedback b/examples/feedback
index ee4eb8d..0a38aca 100755
--- a/examples/feedback
+++ b/examples/feedback
@@ -1,49 +1,63 @@
 #!/usr/bin/perl
 
-# Revision 1.0: Released it
-#          1.1: Marc Lehman added undo capability! <pcg goof com>
-#          1.2: Added my email, and put it in "Noise" where it belongs
-#                <sjburges gimp org>
-#          1.3: changed undo grouping to be 1.3.24+ compatible
-
-
 use Gimp;
 use Gimp::Fu;
 
-register "feedback",
-        "Take an image and feed it back onto itself multiple times",
-        "This plug-in simulates video feedback.  It makes for kinda a neat desktop if you're into that sort 
of thing",
-        "Seth Burgess",
-        "Seth Burgess <sjburges\ gimp org>",
-        "2-15-99",
-        N_"<Image>/Filters/Noise/Feedback...",
-        "RGB, GRAY",
-        [
-         [PF_SLIDER,   "offset",       "the amount the frames will offset", 3, [0, 255, 1]],
-         [PF_SLIDER,   "repeat",       "the number of times to repeat the illusion", 3, [0, 100, 1]],
-        ],
-        sub {
-   my($img,$drawable,$offset,$repeat)= _;
-
-   eval { $img->undo_group_start };
-
-   for (; $repeat>0; $repeat--) {
-        $drawable = $img->flatten;
-        $copylayer = $drawable->copy(1);
-        $img->insert_layer($copylayer,0,0);
-        $copylayer->scale($img->width - $offset, $img->height - $offset, 0);
-       }
-       $img->flatten;
-   eval { $img->undo_group_end };
-       return();
+podregister {
+  $image->undo_group_start;
+  for (; $repeat>0; $repeat--) {
+    $drawable = $image->flatten;
+    my $copylayer = $drawable->copy(1);
+    $image->insert_layer($copylayer,0,0);
+    $copylayer->scale($image->width - $offset, $image->height - $offset, 0);
+  }
+  $image->flatten;
+  $image->undo_group_end;
+  ();
 };
 
 exit main;
+__END__
+
+=head1 NAME
+
+feedback - Take an image and feed it back onto itself multiple times
+
+=head1 SYNOPSIS
+
+<Image>/Filters/Noise/Feedback...
+
+=head1 DESCRIPTION
+
+This plug-in simulates video feedback. It makes for kinda a neat desktop
+if you're into that sort of thing.
+
+=head1 PARAMETERS
+
+  [PF_SLIDER, "offset", "Amount the frames will offset", 3, [0, 255, 1]],
+  [PF_SLIDER, "repeat", "Number of times to repeat the illusion", 3, [0, 100, 1]],
+
+=head1 IMAGE TYPES
+
+RGB, GRAY
+
+=head1 AUTHOR
+
+Seth Burgess <sjburges gimp org>
+
+=head1 HISTORY
+
+ Revision 1.0: Released it
+          1.1: Marc Lehman added undo capability! <pcg goof com>
+          1.2: Added my email, and put it in "Noise" where it belongs
+                <sjburges gimp org>
+          1.3: changed undo grouping to be 1.3.24+ compatible
+
+=head1 DATE
+
+2-15-99
 
 =head1 LICENSE
 
 Copyright Seth Burgess.
 Distributed under the same terms as Gimp-Perl.
-
-=cut
-
diff --git a/examples/frame_reshuffle b/examples/frame_reshuffle
index dc88b7f..8119447 100755
--- a/examples/frame_reshuffle
+++ b/examples/frame_reshuffle
@@ -70,7 +70,7 @@ Examples:
 
  [PF_RADIO, "function", "Which remapping function to use", 1,
   [Custom => 0, Reverse => 1, Shift => 2] ],
- [PF_STRING, "custom", "The (optional) custom function to use, e.g. 'n-i' reverses the order"],
+ [PF_STRING, "custom", "Optional custom function to use, e.g. 'n-i' reverses the order"],
 
 =head1 IMAGE TYPES
 
diff --git a/examples/gallery b/examples/gallery
index 492f2f9..2f45a3b 100755
--- a/examples/gallery
+++ b/examples/gallery
@@ -1,45 +1,4 @@
 #!/usr/bin/perl
-# gallery.pl
-#
-# Copyright (c) Fabian Frederick 2001
-#
-# 2004-03-28 (Dov)
-#       - Fixed for Gimp-2.0
-#
-# 17/07/2001 (Fab)
-# V2.0
-#      -Adding Html instance per picture + Header
-#      -Adding URL
-#
-# 07/07/2001 (Darkin)
-#      -Item was unreachable from menu because of RGB requesite -> undef.
-#
-# 17/6/2001 (Fab)
-# V1.3
-#      -Adding global progression bar
-#      -Preserving Gimp cache (progressive image_delete)
-#      -Adding trailing / to path
-#      -Plugin crashed when no label was given
-# 25/5/2001 (Fab)
-# V1.2 -Bug in rotation parameter : OK
-#      -Adding color for label(Parasite editor helped here :) ).
-#      -Register as gallery_maker
-#      -Adding corner selection for copyright using layer_translate
-#      -Recovering colors for HTML (Thanks Marc).
-#
-# 18/19/5/2001 (Fab)
-# V1.01 -Moving plug-in to Toolbox/Render menu
-#      -Added some error-handling
-#      -Automatically put html file in gallery path
-#      -Added some features to HTML generated
-#      -Simplified I/O
-#      -Status supply
-#      -Source is not overwritten anymore .... c$name applied.
-#      -Working in sub-path (using gallery title)
-#      -HTML file not deployed in /tmp (directly in dpath)
-# 10-13/5/2001 (Fab)
-# V1.0 First workable version.
-#
 
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
@@ -48,211 +7,228 @@ use Gimp::Util;
 #Gimp::set_trace(TRACE_ALL);
 
 sub printHeader {
-       my ($rf,$gf,$bf,$r,$g,$b, $htmlFile,$gallerytitle)= _;
-       printf $htmlFile "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">";
-       printf $htmlFile "<body bgcolor='#%x%x%x'>\n",$r,$g,$b;
-       printf $htmlFile "<center><font face=\"verdana,arial\" size=\"5\" color=\"#%x%x%x\">",$rf,$gf,$bf;
-       printf $htmlFile "$gallerytitle\n";
-       printf $htmlFile "<table><tr>\n";
+  my ($rf,$gf,$bf,$r,$g,$b, $htmlFile,$gallerytitle)= _;
+  printf $htmlFile "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">";
+  printf $htmlFile "<body bgcolor='#%x%x%x'>\n",$r,$g,$b;
+  printf $htmlFile "<center><font face=\"verdana,arial\" size=\"5\" color=\"#%x%x%x\">",$rf,$gf,$bf;
+  printf $htmlFile "$gallerytitle\n";
+  printf $htmlFile "<table><tr>\n";
 }
 
-
 sub printFooter {
-       my ($rf,$gf,$bf,$URL, $htmlFile)= _;
-       printf $htmlFile "<br><br><hr size=\"1\" color=\"white\"><a href=\"$URL\">Back to previous 
page</a>\n";
-       printf $htmlFile "</body>\n</html>";
-
+  my ($rf,$gf,$bf,$URL, $htmlFile)= _;
+  printf $htmlFile "<br><br><hr size=\"1\" color=\"white\"><a href=\"$URL\">Back to previous page</a>\n";
+  printf $htmlFile "</body>\n</html>";
 }
 
-sub galleryMaker {
-   my ($path, $label, $labelcolor, $labelpos, $font, $bright, $contrast, $rotate, $scalefix, $fixed, 
$gallerytitle, $color, $foregroundcolor, $galleryfile,$columns,$parentURL) = @_;
-
-   $oldforeground=gimp_context_get_foreground();
-   $path=$path.'/';
-   if ($path eq ""){
-       Gimp->message(__"All fields were not completed, sorry.");
-       exit main;
-   }
-   if ($fixed == 0){
-       Gimp->message(__"Scale factor has not to be 0");
-       exit main;
-   }
-
-   $countTotal=`ls $path*.jpg | wc -l`+`ls $path*.JPG | wc -l`;
-   $gallerytitle=~s/ /_/g;
-   opendir(CPATH, $path) or die ("Unable to open destination path");
-   $sysval=system("mkdir $path$gallerytitle");
-   if ($sysval != 0){
-       Gimp->message(__"Make sure you've got write access to selected path ...\nMaybe the target path 
already exist in which case you can simply change the Gallery title and launch again");
-       exit main;
-   }
-   my $dpath="$path$gallerytitle/";
-   open (htmlFile, "> $dpath$galleryfile.html") or die ("Unable to process HTML File.");
-
-   my ($rf,$gf, $bf)= $foregroundcolor;
-   my ($r,$g,$b)= $color;
-   printHeader($rf,$gf,$bf,$r,$g,$b,*htmlFile,$gallerytitle);
-   print htmlFile "<table><tr>\n";
-   my $totalentries=0;
-   my $entries=1;
-   my $twidthEval=0;
-   my $txtwidth=0;
-   my $txtheight=0;
-   my $ycorrection=0;
-   my $xcorrection=0;
-
-   Gimp->progress_init("Releasing the gallery");
-   while (defined($cfile=readdir(CPATH))) {
-          if (( $cfile =~ /.jpg/ ) || ($cfile =~ /.JPG/)) {
-                  my $img=gimp_file_load("$path$cfile", "$path$cfile");
-                  my $clayer=gimp_image_get_active_layer($img);
-                  if ($rotate != 0){
-                       #plug_in_rotate manages both global 90-180-270 - reshape $img
-                       plug_in_rotate(RUN_NONINTERACTIVE,$img,-1,$rotate,1);
-                  }
-
-                  my $width=gimp_image_width($img);
-                  my $height=gimp_image_height($img);
-                  gimp_brightness_contrast($clayer, $bright, $contrast);
-                  if ( $label ne "" ){
-                          my $newlayer=gimp_layer_new($img, 200, 100, RGB_IMAGE, "newlayer", 100, 
NORMAL_MODE);
-                          gimp_context_set_foreground($labelcolor);
-                          my $txtlayer=gimp_text_fontname($img, -1, 1, 1, $label, 0, 0, 16, 0, $font);
-                          if ($twidthEval == 0) {
-                               $txtwidth=gimp_drawable_width($txtlayer);
-                               $txtheight=gimp_drawable_height($txtlayer);
-                               $twidthEval=1;
-                          }
-                          $ycorrection=$height-$txtheight if (($labelpos == 2) || ($labelpos == 3));
-                          $xcorrection=$width-$txtwidth if (($labelpos == 1) || ($labelpos == 3));
-                          gimp_layer_translate($txtlayer, $xcorrection, $ycorrection);
-                          gimp_image_merge_visible_layers($img,0);
-                  }
-                  my $cvname="$dpath$cfile";
-                  #$cvname=~s/ /c/g;
-                  ($img->get_layers)[0]->file_jpeg_save("$cvname", "$cvname",0.7,0,1,0,"",0,1,0,0);
-
-                  #Processing Thumbnail
-                  my $tbheight=1;
-                  my $tbwidth=1;
-                  if ($scalefix == 1){
-                                   my $scalefactor=$width/$fixed;
-                                   $tbheight=$height/$scalefactor;
-                                   $tbwidth=$fixed;
-                         }else{
-                                   if ($scalefix == 2) {
-                                          my $scalefactor=$height/$fixed;
-                                          my $newwidth=$width/$scalefactor;
-                                          $tbwidth=$newwidth;
-                                          $tbheight=$fixed;
-                                   }else {
-                                          # scalefix 0 => both scaled by factor (value_factor)
-                                          $tbwidth=$width/$fixed;
-                                          $tbheight=$height/$fixed;
-                                   }
-                  }
-                  my $tbfname="$dpath $cfile";
-                  $tbfname=~s/ /m/g;
-                  system("cp $cvname $tbfname");
-                  gimp_image_delete($img);
-                  $img=gimp_file_load("$tbfname", "$tbfname");
-                  $clayer=gimp_image_get_active_layer($img);
-                  gimp_image_scale($img, $tbwidth, $tbheight);
-
-                  #Processing detail HTML
-                  my $htmlDetail=$cfile;
-                  $htmlDetail=~s/.jpg/.html/g;
-                  $htmlDetail=~s/.JPG/.html/g;
-                  open (fhtmlDetail, "> $dpath$htmlDetail") or die ("Unable to process HTML File.");
-                  printHeader($rf,$gf,$bf,$r,$g,$b,*fhtmlDetail,$gallerytitle);
-                  print fhtmlDetail "<img src=\"$cfile\"></img>";
-                  printFooter($rf,$gf,$bf,"$galleryfile.html", *fhtmlDetail);
-                  close fhtmlDetail;
-                  file_jpeg_save(($img->get_layers)[0],"$tbfname", "$tbfname",0.7,0,1,0,"",0,1,0,0);
-                  print htmlFile "             <td><a href='$htmlDetail'><img src='m$cfile' 
border='0'></a></td>\n";
-                  if ($entries >= $columns){
-                               print htmlFile "</tr><tr>";
-                               $entries=1;
-                           }else{
-                               $entries=$entries+1;
-                  }
-         $totalentries=$totalentries+1;
-         Gimp->progress_update ($totalentries/$countTotal);
-         gimp_image_delete($img);
-         }
+podregister {
+  $oldforeground=gimp_context_get_foreground();
+  $path.='/';
+  die __"All fields were not completed, sorry.\n" if $path eq "";
+  die __"Scale factor must not be 0\n" if $fixed == 0;
+
+  $countTotal=`ls $path*.jpg | wc -l`+`ls $path*.JPG | wc -l`;
+  $gallerytitle=~s/ /_/g;
+  opendir(CPATH, $path) or die ("Unable to open destination path");
+  $sysval=system("mkdir $path$gallerytitle");
+  if ($sysval != 0){
+    die __"Make sure you've got write access to selected path ...\nMaybe the target path already exist in 
which case you can simply change the Gallery title and launch again\n";
+  }
+  my $dpath="$path$gallerytitle/";
+  open (htmlFile, "> $dpath$galleryfile.html") or die ("Unable to process HTML File.");
+
+  my ($rf,$gf, $bf)= $foregroundcolor;
+  my ($r,$g,$b)= $color;
+  printHeader($rf,$gf,$bf,$r,$g,$b,*htmlFile,$gallerytitle);
+  print htmlFile "<table><tr>\n";
+  my $totalentries=0;
+  my $entries=1;
+  my $twidthEval=0;
+  my $txtwidth=0;
+  my $txtheight=0;
+  my $ycorrection=0;
+  my $xcorrection=0;
+
+  Gimp->progress_init("Releasing the gallery");
+  while (defined($cfile=readdir(CPATH))) {
+    if (( $cfile =~ /.jpg/ ) || ($cfile =~ /.JPG/)) {
+      my $img=gimp_file_load("$path$cfile", "$path$cfile");
+      my $clayer=gimp_image_get_active_layer($img);
+      if ($rotate != 0){
+       #plug_in_rotate manages both global 90-180-270 - reshape $img
+       plug_in_rotate(RUN_NONINTERACTIVE,$img,-1,$rotate,1);
+      }
+
+      my $width=gimp_image_width($img);
+      my $height=gimp_image_height($img);
+      gimp_brightness_contrast($clayer, $bright, $contrast);
+      if ( $label ne "" ) {
+       my $newlayer=gimp_layer_new($img, 200, 100, RGB_IMAGE, "newlayer", 100, NORMAL_MODE);
+       gimp_context_set_foreground($labelcolor);
+       my $txtlayer=gimp_text_fontname($img, -1, 1, 1, $label, 0, 0, 16, 0, $font);
+       if ($twidthEval == 0) {
+         $txtwidth=gimp_drawable_width($txtlayer);
+         $txtheight=gimp_drawable_height($txtlayer);
+         $twidthEval=1;
+       }
+       $ycorrection=$height-$txtheight if (($labelpos == 2) || ($labelpos == 3));
+       $xcorrection=$width-$txtwidth if (($labelpos == 1) || ($labelpos == 3));
+       gimp_layer_translate($txtlayer, $xcorrection, $ycorrection);
+       gimp_image_merge_visible_layers($img,0);
+      }
+      my $cvname="$dpath$cfile";
+      #$cvname=~s/ /c/g;
+      ($img->get_layers)[0]->file_jpeg_save("$cvname", "$cvname",0.7,0,1,0,"",0,1,0,0);
+
+      #Processing Thumbnail
+      my $tbheight=1;
+      my $tbwidth=1;
+      if ($scalefix == 1){
+       my $scalefactor=$width/$fixed;
+       $tbheight=$height/$scalefactor;
+       $tbwidth=$fixed;
+      } else {
+       if ($scalefix == 2) {
+         my $scalefactor=$height/$fixed;
+         my $newwidth=$width/$scalefactor;
+         $tbwidth=$newwidth;
+         $tbheight=$fixed;
+       } else {
+         # scalefix 0 => both scaled by factor (value_factor)
+         $tbwidth=$width/$fixed;
+         $tbheight=$height/$fixed;
+       }
+      }
+      my $tbfname="$dpath $cfile";
+      $tbfname=~s/ /m/g;
+      system("cp $cvname $tbfname");
+      gimp_image_delete($img);
+      $img=gimp_file_load("$tbfname", "$tbfname");
+      $clayer=gimp_image_get_active_layer($img);
+      gimp_image_scale($img, $tbwidth, $tbheight);
+
+      #Processing detail HTML
+      my $htmlDetail=$cfile;
+      $htmlDetail=~s/.jpg/.html/g;
+      $htmlDetail=~s/.JPG/.html/g;
+      open (fhtmlDetail, "> $dpath$htmlDetail") or die ("Unable to process HTML File.");
+      printHeader($rf,$gf,$bf,$r,$g,$b,*fhtmlDetail,$gallerytitle);
+      print fhtmlDetail "<img src=\"$cfile\"></img>";
+      printFooter($rf,$gf,$bf,"$galleryfile.html", *fhtmlDetail);
+      close fhtmlDetail;
+      file_jpeg_save(($img->get_layers)[0],"$tbfname", "$tbfname",0.7,0,1,0,"",0,1,0,0);
+      print htmlFile "         <td><a href='$htmlDetail'><img src='m$cfile' border='0'></a></td>\n";
+      if ($entries >= $columns){
+       print htmlFile "</tr><tr>";
+       $entries=1;
+      } else {
+       $entries=$entries+1;
+      }
+      $totalentries=$totalentries+1;
+      Gimp->progress_update ($totalentries/$countTotal);
+      gimp_image_delete($img);
     }
-    Gimp->progress_update(1);
-    print htmlFile "</table>\n";
-    printFooter($rf,$gf,$bf,$parentURL, *htmlFile);
-    close htmlFile;
-    Gimp->message(__"Your gallery ($galleryfile) has been generated through Gallery plug-in with 
$totalentries entries");
-    gimp_context_set_foreground($oldforeground);
-   # return();
-
-}
+  }
+  Gimp->progress_update(1);
+  print htmlFile "</table>\n";
+  printFooter($rf,$gf,$bf,$parent_url, *htmlFile);
+  close htmlFile;
+  Gimp->message(__"Your gallery ($galleryfile) has been generated through Gallery plug-in with $totalentries 
entries");
+  gimp_context_set_foreground($oldforeground);
+  ();
+};
 
-$help=<<EOF.$help;
-This script will hopefully help you creating an html gallery of a path full of JPG pictures ... This one 
creates thumbnails - Copyright notice on picture and some other cool tips.
-EOF
-
-register("gallerymaker",
-        "Generate your gallery in HTML format + some picture improvements",
-        $help,
-        "Fabian Frederick <Fabian Frederick\ gmx fr>",
-        "(c) 2001 Fabian Frederick",
-        "20010601",
-        N_"<Toolbox>/Xtns/Render/Gallery Maker",
-        undef,
-        [
-         [PF_FILE,   "path", "Destination path .... "],
-         [PF_STRING, "label", "Text to add at the top of each picture"],
-         [PF_COLOR,  "label_color", "Color of the label to be displayed on each picture", [255,255,255]],
-         [PF_RADIO,  "label_position", "Position of your text label...", 0, [ UpLeft => 0, UpRight => 1, 
DownLeft => 2, DownRight => 3 ]],
-         [PF_FONT,   "displayfont", "Select font", undef ],
-         [PF_SLIDER, "brightness", "Brightness correction", 0, [ -127, 127]],
-         [PF_SLIDER, "contrast", "Contrast correction", 0, [-127,127]],
-         [PF_RADIO,  "rotate", "Rotation angle", 0, [ None => 0, Rotate90CCW => 3, Rotate90 => 1]],
-         [PF_RADIO,  "scalefix", "Scale fixing for thumbnails", 1 ,[ both_by_factor => 0, X => 1, Y => 2 ]],
-         [PF_INT32,  "value_factor", "value or factor", 150],
-         [PF_STRING, "gallery_title", "Gallery's Title" ],
-         [PF_COLOR,  "background_color","Gallery background color", [100,100,100]],
-         [PF_COLOR,  "foreground_color","Gallery background color", [255,255,255]],
-         [PF_STRING, "gallery_file", "HTML file generated" ],
-         [PF_INT32,  "columns", "Gallery columns number", 2],
-         [PF_STRING, "parent_file", "Gallery's parent URL" ]
-        ],
-        \&galleryMaker);
 exit main;
-
 __END__
 
 =head1 NAME
 
-gallery - Gallery Maker
+gallerymaker - Generate your gallery in HTML format + some picture improvements
 
 =head1 SYNOPSIS
 
-Gallery Maker
+<Image>/Filters/Render/Gallery Maker
 
 =head1 DESCRIPTION
 
-Gallery Maker is a Gimp plugin.It generates an HTML file from all pictures
-it finds in a designed path.A thumbnail is generated from each picture
-with a desired global scale or X or Y fixed...This tool will hopefully
-help batch conversions from photo albums for instance as you can add
-copyright notice on source picture but also adjust brightness/contrast
-or give polar rotations ....
+Generates an HTML file from all pictures it finds in a designed path. A
+thumbnail is generated from each picture with a desired global scale or X
+or Y fixed...This tool will hopefully help batch conversions from photo
+albums for instance as you can add copyright notice on source picture
+but also adjust brightness/contrast or give polar rotations.
 
 Convention used here is the following : All pictures converted is c<name>.
 Relative thumbnail is m<name>.
 
 Note : This plugin only processes JPG pictures.
 
+=head1 PARAMETERS
+
+  [PF_FILE,   "path", "Destination path"],
+  [PF_STRING, "label", "Text at top of each picture"],
+  [PF_COLOR,  "labelcolor", "Color of label on each picture", [255,255,255]],
+  [PF_RADIO,  "labelpos", "Position of text label", 0, [ UpLeft => 0, UpRight => 1, DownLeft => 2, DownRight 
=> 3 ]],
+  [PF_FONT,   "font", "Select font", undef ],
+  [PF_SLIDER, "bright", "Brightness correction", 0, [ -127, 127]],
+  [PF_SLIDER, "contrast", "Contrast correction", 0, [-127,127]],
+  [PF_RADIO,  "rotate", "Rotation angle", 0, [ None => 0, Rotate90CCW => 3, Rotate90 => 1]],
+  [PF_RADIO,  "scalefix", "Scale fixing for thumbnails", 1 ,[ both_by_factor => 0, X => 1, Y => 2 ]],
+  [PF_INT32,  "fixed", "Value or factor", 150],
+  [PF_STRING, "gallerytitle", "Gallery title" ],
+  [PF_COLOR,  "color", "Gallery background color", [100,100,100]],
+  [PF_COLOR,  "foregroundcolor","Gallery foreground color", [255,255,255]],
+  [PF_STRING, "galleryfile", "HTML file generated" ],
+  [PF_INT32,  "columns", "Gallery columns number", 2],
+  [PF_STRING, "parent_url", "Gallery's parent URL" ]
+
 =head1 AUTHOR
 
-Written by Fabian Frederick <fabian frederick gmx fr>, (c) 2001
+Fabian Frederick <fabian frederick gmx fr>
+
+=head1 DATE
+
+20010601
+
+=head1 HISTORY
+
+ 2004-03-28 (Dov)
+       - Fixed for Gimp-2.0
+
+ 17/07/2001 (Fab)
+ V2.0
+       -Adding Html instance per picture + Header
+       -Adding URL
+
+ 07/07/2001 (Darkin)
+       -Item was unreachable from menu because of RGB requesite -> undef.
+
+ 17/6/2001 (Fab)
+ V1.3
+       -Adding global progression bar
+       -Preserving Gimp cache (progressive image_delete)
+       -Adding trailing / to path
+       -Plugin crashed when no label was given
+ 25/5/2001 (Fab)
+ V1.2 -Bug in rotation parameter : OK
+       -Adding color for label(Parasite editor helped here :) ).
+       -Register as gallery_maker
+       -Adding corner selection for copyright using layer_translate
+       -Recovering colors for HTML (Thanks Marc).
+
+ 18/19/5/2001 (Fab)
+ V1.01 -Moving plug-in to Toolbox/Render menu
+       -Added some error-handling
+       -Automatically put html file in gallery path
+       -Added some features to HTML generated
+       -Simplified I/O
+       -Status supply
+       -Source is not overwritten anymore .... c$name applied.
+       -Working in sub-path (using gallery title)
+       -HTML file not deployed in /tmp (directly in dpath)
+ 10-13/5/2001 (Fab)
+ V1.0  First workable version.
 
 =head1 LICENSE
 
 Copyright Fabian Frederick.
-This plugin may be distributed under the same terms as The Gimp itself.
+This plugin may be distributed under the same terms as GIMP itself.
diff --git a/examples/iland b/examples/iland
index 1b33de7..1175a87 100755
--- a/examples/iland
+++ b/examples/iland
@@ -1,143 +1,129 @@
 #!/usr/bin/perl
-# iland.pl
-#
-# Copyright (c) Fabian Frederick 2001
-#
+
 # 02/06/2001
 # V1.0
 #        -The stuff works but it's still slow.
 #        Problem resides in the brutal m/slice.
 #        I hope to find out some artifact to use PDL more efficiently for this "non-matrix" algorithm.
-#
-#
 
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use PDL::LiteF;
 
-sub landscape {
-
-       my ($image, $drawable, $floor,$component, $delta,$elevation, $camerapos) = @_;
-
-       #gimp_tile_cache_size(20000);
-       gimp_selection_none($image);
-       plug_in_rotate(RUN_NONINTERACTIVE, $image, -1, $camerapos, 1) if ($camerapos != 0);
-       $width=gimp_image_width($image);
-       $height=gimp_image_height($image);
-       my $gdrawable=$drawable->get();
-
-       #Pixel region of selection
-       my $src= new Gimp::PixelRgn ($drawable, 0,0,$width, $height, 0, 0);
-       my $newimage=gimp_image_new($src->w, $src->h, 0);
-       $layer=gimp_layer_new($newimage,$src->w, $src->h, RGB_IMAGE, "L1", 100, NORMAL_MODE);
-       gimp_image_insert_layer($layer, 0, -1);
-       $newdrawable=gimp_get_image_active_drawable($newimage);
-       my $dest = new Gimp::PixelRgn ($newdrawable, 0,0,$width, $height,1,1);
-       Gimp->progress_init("Rendering...");
-       my $relord=$src->w/255;
-
-       gimp_drawable_fill($newdrawable, 0);
-       $delta=1 if ($delta<1);
-       for (my $y=0; $y<$src->h; $y++){
-               $row=$src->get_row(0, $y, $src->w);
-               my $drow=$row&0;
-               $red=$row->slice($component);
-               $dred=$drow->slice(0);
-               $dgreen=$drow->slice(1);
-               $dblue=$drow->slice(2);
-               for(my $x=0;$x<$src->w;$x++){
-                       $r=at($red,0,$x);
-                       if ($r>$floor){
-                               my $remain=$r;
-                               my $currentx=$width-$r*$relord+($x/$elevation);
-                               #Apply elevation following the x offset in original picture
-                               while ($remain>0 && $currentx<$src->w){
-                                       if($remain>150){
-                                               set ($dblue,0,$currentx,$remain);
-                                               set ($dred,0,$currentx,0);
-                                               set ($dgreen,0,$currentx,$remain);
-                                       }
-                                       if($remain<150 && $remain>50){
-                                               set ($dgreen,0,$currentx,$remain+55);
-                                               set ($dred,0,$currentx,0);
-                                               set ($dblue,0,$currentx,0);
-                                       }
-                                       if($remain<50){
-                                               set ($dred,0,$currentx,0);
-                                               set ($dgreen,0,$currentx,0);
-                                               set ($dblue,0,$currentx,$remain+200);
-                                       }
-                                       $remain-=$delta;
-                                       $currentx++;
-                               }
-                       }
-               }
-               $dest->set_row($drow, 0,$y);
-               Gimp->progress_update($y/$src->h);
-       }
-       Gimp->progress_update(1);
-       $newdrawable->merge_shadow(1);
-       $newdrawable->update(0,0,$width, $height);
-       plug_in_rotate($newdrawable,1,1);
-       $newdrawable->merge_shadow(1);
-       $newdrawable->update(0,0,$width, $height);
-
-       Gimp->display_new($newimage);
-
-       #Original pic => original state
-       if($camerapos==3){
-               $camerapos=1;
-         }else{
-               if ($camerapos==1){
-                       $camerapos=3;
-               }
+podregister {
+  #gimp_tile_cache_size(20000);
+  gimp_selection_none($image);
+  plug_in_rotate(RUN_NONINTERACTIVE, $image, -1, $camerapos, 1) if ($camerapos != 0);
+  $width=gimp_image_width($image);
+  $height=gimp_image_height($image);
+  my $gdrawable=$drawable->get();
+
+  #Pixel region of selection
+  my $src= new Gimp::PixelRgn ($drawable, 0,0,$width, $height, 0, 0);
+  my $newimage=gimp_image_new($src->w, $src->h, 0);
+  $layer=gimp_layer_new($newimage,$src->w, $src->h, RGB_IMAGE, "L1", 100, NORMAL_MODE);
+  gimp_image_insert_layer($layer, 0, -1);
+  $newdrawable=gimp_get_image_active_drawable($newimage);
+  my $dest = new Gimp::PixelRgn ($newdrawable, 0,0,$width, $height,1,1);
+  Gimp->progress_init("Rendering...");
+  my $relord=$src->w/255;
+
+  gimp_drawable_fill($newdrawable, 0);
+  $delta=1 if ($delta<1);
+  for (my $y=0; $y<$src->h; $y++){
+    $row=$src->get_row(0, $y, $src->w);
+    my $drow=$row&0;
+    $red=$row->slice($component);
+    $dred=$drow->slice(0);
+    $dgreen=$drow->slice(1);
+    $dblue=$drow->slice(2);
+    for(my $x=0;$x<$src->w;$x++) {
+      $r=at($red,0,$x);
+      if ($r>$floor) {
+       my $remain=$r;
+       my $currentx=$width-$r*$relord+($x/$elevation);
+       #Apply elevation following the x offset in original picture
+       while ($remain>0 && $currentx<$src->w) {
+         if($remain>150){
+           set ($dblue,0,$currentx,$remain);
+           set ($dred,0,$currentx,0);
+           set ($dgreen,0,$currentx,$remain);
+         }
+         if($remain<150 && $remain>50){
+           set ($dgreen,0,$currentx,$remain+55);
+           set ($dred,0,$currentx,0);
+           set ($dblue,0,$currentx,0);
+         }
+         if($remain<50){
+           set ($dred,0,$currentx,0);
+           set ($dgreen,0,$currentx,0);
+           set ($dblue,0,$currentx,$remain+200);
+         }
+         $remain-=$delta;
+         $currentx++;
        }
-       plug_in_rotate($image, -1, $camerapos, 1) if ($camerapos != 0);
-
-}
-
-register "intensitylandscape",
-        "Generate an intensity based landscape",
-        "Generate an alpha landscape based on intensity",
-        "Fabian Frederick",
-        "(c) 2001 Fabian Frederick",
-        "20010601",
-        N_"<Image>/Filters/Render/Intensity Landscape",
-        "*",
-        [
-               [PF_SLIDER, "floor", "Floor", 100, [0, 255]],
-               [PF_RADIO, "active_component", "Active Component", 0, [ Red => 0, Green => 1, Blue => 2]],
-               [PF_SLIDER, "delta", "delta color", 6, [0, 100]],
-               [PF_FLOAT, "elevation", "elevation argument should be 2 or 3", 2],
-               [PF_RADIO, "camera", "camera position", 0, [ Right => 0, Bottom => 3, Left => 2, Top => 1]]
-
-        ],
-        \&landscape;
-exit main;
+      }
+    }
+    $dest->set_row($drow, 0,$y);
+    Gimp->progress_update($y/$src->h);
+  }
+  Gimp->progress_update(1);
+  $newdrawable->merge_shadow(1);
+  $newdrawable->update(0,0,$width, $height);
+  plug_in_rotate($newdrawable,1,1);
+  $newdrawable->merge_shadow(1);
+  $newdrawable->update(0,0,$width, $height);
+
+  Gimp->display_new($newimage);
+
+  #Original pic => original state
+  if ($camerapos==3){
+    $camerapos=1;
+  } elsif ($camerapos==1) {
+    $camerapos=3 ;
+  }
+  plug_in_rotate($image, -1, $camerapos, 1) if ($camerapos != 0);
+  ();
+};
 
+exit main;
 __END__
 
 =head1 NAME
 
-Intensity Landscape
+intensitylandscape - Generate an intensity based landscape
 
 =head1 SYNOPSIS
 
-Intensity Landscape
+<Image>/Filters/Render/Intensity Landscape
 
 =head1 DESCRIPTION
 
-Intensity Landscape is a Gimp plugin generating a landscape from original picture.The result is an 
interpolated view as if you were looking from one side
-of the original picture (which is an taken as an apical view).
+Generate an alpha landscape based on intensity.  The result is an
+interpolated view as if you were looking from one side of the original
+picture (which is an taken as an apical view).
 
 =head1 AUTHOR
 
-Written by Fabian Frederick <fabian frederick gmx fr>, (c) 2001
+Fabian Frederick <fabian frederick gmx fr>
+
+=head1 DATE
+
+20010601
+
+=head1 IMAGE TYPES
+
+*
+
+=head1 PARAMETERS
+
+  [PF_SLIDER, "floor", "Floor", 100, [0, 255]],
+  [PF_RADIO, "component", "Active component", 0, [ Red => 0, Green => 1, Blue => 2]],
+  [PF_SLIDER, "delta", "Delta color", 6, [0, 100]],
+  [PF_FLOAT, "elevation", "Elevation argument should be 2 or 3", 2],
+  [PF_RADIO, "camerapos", "Camera position", 0, [ Right => 0, Bottom => 3, Left => 2, Top => 1]]
 
 =head1 LICENSE
 
 Copyright Fabian Frederick.
 This plugin may be distributed under the same terms as The Gimp itself.
-
-=cut
-
diff --git a/examples/image_tile b/examples/image_tile
index 06ba9df..bcf032c 100755
--- a/examples/image_tile
+++ b/examples/image_tile
@@ -1,33 +1,5 @@
 #!/usr/bin/perl
 
-# A photo-tiling pluggin. Take an image, and tile it (much like the
-# mosaic operation, only using other images).
-#
-# Written in 1998 (c) by Aaron Sherman <ajs ajs com>.
-# This plugin may be distributed under the same terms as The Gimp itself.
-# See http://www.gimp.org/ for more information on The Gimp.
-#
-# TODO:
-#
-#      o Fix undo
-#      o Handle input drawable correctly (for working on selections)
-#      o Find faster ways to sample sub-images.
-#      o More control over cropping
-#      o Scaling vs cropping of sub-images
-#      o Better color matching algorithms
-#      o Test (fix?) non-interactive use...
-#      o Allow tile aspect selection independant of base image
-#
-# DONE:
-#       o 04-22-2001, peter kirchgessner net: fix problems with functions
-#         that changed number of arguments
-#
-#12/5/03: <sjburges gimp org>
-# s/gimp_convert/gimp_image_convert/
-# s/gimp_drawable_image/gimp_drawable_get_image/
-
-
-
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 use Fcntl qw(O_RDWR O_CREAT O_TRUNC);
@@ -38,31 +10,7 @@ use DB_File;
 $DO_HSV = 0;
 $debug = 0;
 
-# This function takes:
-#      Gimp-provided:
-#      Image -- The gimp image to be operated on.
-#      Drawable -- Its drawable
-#      User-provided:
-#      X Tiles -- Number of images to be tiled across.
-#      Y Tiles -- Number of images to be tiled down.
-#      X Cells -- Number of color samples across for each image.
-#      Y Cells -- Number of color samples down for each image.
-#      Duplicates Weight -- Amount of weight to apply against images that
-#              have already been used.
-#      Directories -- Space separated list of directories.
-#
-# It will tile the images from the given directories over the given
-# image to form a mosaic of the original.
-sub perl_fu_image_tile {
-  my $image = shift;
-  my $drawable = shift;
-  my $xtiles = shift;
-  my $ytiles = shift;
-  my $xcells = shift;
-  my $ycells = shift;
-  my $dupweight = shift;
-  my $dirs = shift;
-  my $cleanup = shift;
+podregister {
   my $subimages = 0;
   my $TOP = "$ENV{HOME}/.gimp";
   if (! -d $TOP) {
@@ -288,7 +236,8 @@ sub perl_fu_image_tile {
   gimp_progress_update(1);
   gimp_image_undo_enable($image);
   gimp_displays_flush();
-}
+  ();
+};
 
 # Take IMAGE, XCELLS, YCELLS, TARGET_ASPECT.
 # Works destructively on IMAGE, and returns a list of anon-lists which
@@ -363,23 +312,23 @@ sub match_aspect {
 # Opens image referenced by INFO->{name} and scale/crop to fit in rectagnle
 # described by X,Y,WIDTH,HEIGHT
 sub overlay_image {
-    my $draw = shift;
-    my $file = shift;
-    my $x = shift;
-    my $y = shift;
-    my $width = shift;
-    my $height = shift;
-    my $img = gimp_file_load($file,$file);
-    my $subwidth = gimp_image_width($img);
-    my $subheight = gimp_image_height($img);
-    match_aspect($img,$width/$height,$subwidth,$subheight);
-    gimp_image_scale($img,$width,$height);
-    gimp_edit_copy(gimp_image_get_active_drawable($img)); #gimp 1.1 -deleted $img
-    my $baseimg = gimp_item_get_image($draw);
-    gimp_image_select_rectangle(CHANNEL_OP_REPLACE,$baseimg,$x,$y,$width,$height);
-    my $sel = gimp_edit_paste($draw,0); # gimp 1.1 -deleted $baseimg
-    gimp_floating_sel_anchor($sel);
-    gimp_image_delete($img);
+  my $draw = shift;
+  my $file = shift;
+  my $x = shift;
+  my $y = shift;
+  my $width = shift;
+  my $height = shift;
+  my $img = gimp_file_load($file,$file);
+  my $subwidth = gimp_image_width($img);
+  my $subheight = gimp_image_height($img);
+  match_aspect($img,$width/$height,$subwidth,$subheight);
+  gimp_image_scale($img,$width,$height);
+  gimp_edit_copy(gimp_image_get_active_drawable($img)); #gimp 1.1 -deleted $img
+  my $baseimg = gimp_item_get_image($draw);
+  gimp_image_select_rectangle(CHANNEL_OP_REPLACE,$baseimg,$x,$y,$width,$height);
+  my $sel = gimp_edit_paste($draw,0); # gimp 1.1 -deleted $baseimg
+  gimp_floating_sel_anchor($sel);
+  gimp_image_delete($img);
 }
 
 # Take a Red, Green, Blue color value and return Hue, Saturation and Value
@@ -427,72 +376,31 @@ sub hue_dist {
   return($d>128?(256-$d):$d);
 }
 
-# Gimp::Fu registration routine for placing this function into gimp's PDB
-register
-  "image_tile",
-  "Tile images to form a larger Image",
-  "Use Image Tile to take a directory of images and use it to
-       construct a single, existing image, sort of like the
-       Filters/Artistic/Mosaic plugin, but with images as the
-       tiles.",
-  "Aaron Sherman", "Aaron Sherman (c)", "1999-03-15",
-  N_"<Image>/Filters/Map/Image Tile...",
-  "*",
-  [
-   # Image and drawable are given for free...
-   # [PF_IMAGE, "Input image", undef],
-   # [PF_DRAWABLE, "Input drawable", undef],
-   [PF_INT32, "tiles_x", "Number of tiles (X)", 10],
-   [PF_INT32, "tiles_y", "Number of tiles (Y)", 10],
-   [PF_INT32, "samples_x", "Number of sample cells per tile (X)", 4],
-   [PF_INT32, "samples_y", "Number of sample cells per tile (Y)", 4],
-   [PF_INT32, "duplicates", "Duplicates (0[lots] - 100[none])", 5],
-   [PF_STRING, "image_dirs", "Sub-image directories (space speparated)"],
-   [PF_TOGGLE, "delete_cached", "Delete cached image samples?", 0]
-  ],
-  \&perl_fu_image_tile;
-
 exit main;
-
 __END__
 
 =head1 NAME
 
-image_tile - An image tiling plug-in for The Gimp
+image_tile - Tile images to form a larger image
 
 =head1 SYNOPSIS
 
-B<image_tile> is called from The Gimp under the Perl-Fu image menu.
+<Image>/Filters/Map/Image Tile...
 
 =head1 DESCRIPTION
 
-B<image_tile> is a plug-in for The Gimp that re-creates an image by tiling many
-sub-images which are in turn chosen for their likeness to a part of the original.
-
-In other words, you give image_tile a base image (the one you open in The
-Gimp, and call image_tile on) and a list of directories to find other images
-in. It then tiles small versions of the images over the original image in
-such a way that you can still make out the original if you squint hard
-enough.
+Re-create an image by tiling many sub-images which are in turn chosen
+for their likeness to a part of the original.
 
-=head1 LIMITATIONS
-
-B<image_tile> requires a large number of image to work from. This is because
-it needs to divide up your original image and for each tile, find another
-image which looks like that tile. This can require anywhere from 2000 to tens
-of thousands of component images.
-
-image_tile will use as much disk space as is required to store the sampling
-information that it creates for each of the sub images. However, its use of
-memory is much more conservative. The assumption being that a lot more people
-have a Gig of disk free than a Gig of RAM. So, expect a large file to be
-created in your .gimp directory (you can select automatic cleanup of this
-file if you wish).
+In other words, you give C<image_tile> a base image and a list of
+directories to find other images in. It then tiles small versions of
+the images over the original image in such a way that you can still make
+out the original if you squint hard enough.
 
-=head1 PARAMETERS
+Functions a little like the Filters/Artistic/Mosaic plugin, but with
+images as the tiles.
 
-When you bring up the image tiler, you are given several options. Each of these
-is detailed below:
+Options:
 
 =over 5
 
@@ -538,10 +446,42 @@ or number of cells. Sorry.
 
 =back
 
+=head1 LIMITATIONS
+
+B<image_tile> requires a large number of image to work from. This is because
+it needs to divide up your original image and for each tile, find another
+image which looks like that tile. This can require anywhere from 2000 to tens
+of thousands of component images.
+
+image_tile will use as much disk space as is required to store the sampling
+information that it creates for each of the sub images. However, its use of
+memory is much more conservative. The assumption being that a lot more people
+have a Gig of disk free than a Gig of RAM. So, expect a large file to be
+created in your .gimp directory (you can select automatic cleanup of this
+file if you wish).
+
+=head1 PARAMETERS
+
+ [PF_INT32, "xtiles", "Number of tiles (X)", 10],
+ [PF_INT32, "ytiles", "Number of tiles (Y)", 10],
+ [PF_INT32, "xcells", "Number of sample cells per tile (X)", 4],
+ [PF_INT32, "ycells", "Number of sample cells per tile (Y)", 4],
+ [PF_INT32, "dupweight", "Duplicates (0[lots] - 100[none])", 5],
+ [PF_STRING, "dirs", "Sub-image directories (space speparated)"],
+ [PF_TOGGLE, "cleanup", "Delete cached image samples", 0]
+
 =head1 AUTHOR
 
 Written in 1998 (c) by Aaron Sherman <ajs ajs com>
 
+=head1 DATE
+
+1999-03-15
+
+=head1 IMAGE TYPES
+
+*
+
 =head1 BUGS
 
 Most of the I<bugs> in the image tiler are actually just design limitations.
@@ -583,13 +523,33 @@ this would require more code than I want to write right now.
 
 =back
 
+=head1 HISTORY
+
+  TODO:
+       o Fix undo
+       o Handle input drawable correctly (for working on selections)
+       o Find faster ways to sample sub-images.
+       o More control over cropping
+       o Scaling vs cropping of sub-images
+       o Better color matching algorithms
+       o Test (fix?) non-interactive use...
+       o Allow tile aspect selection independant of base image
+ 
+  DONE:
+        o 04-22-2001, peter kirchgessner net: fix problems with functions
+          that changed number of arguments
+ 
+ 12/5/03: <sjburges gimp org>
+  s/gimp_convert/gimp_image_convert/
+  s/gimp_drawable_image/gimp_drawable_get_image/
+
 =head1 LICENSE
 
 Copyright Aaron Sherman.
-This plugin may be distributed under the same terms as The Gimp itself.
+This plugin may be distributed under the same terms as GIMP itself.
 
 =head1 SEE ALSO
 
-L<gimp>, L<perl>, L<Gimp>: the Gimp module for perl.
+L<gimp>, L<perl>, L<Gimp>.
 
 =cut
diff --git a/examples/perlotine b/examples/perlotine
index 9f7b5ac..b181dfe 100755
--- a/examples/perlotine
+++ b/examples/perlotine
@@ -145,13 +145,13 @@ and give you the html to reassemble the resulting images.
 
 =head1 PARAMETERS
 
-  [PF_STRING, "savepath", "The path to export the HTML to",$ENV{HOME}],
+  [PF_FILE, "savepath", "The path to export the HTML to",$ENV{HOME}],
   [PF_STRING, "htmlname", "Filename to export","perlotine.html"],
   [PF_STRING, "imgbasename", "What to call the images","perlotine"],
   [PF_RADIO,  "extension", "The format of the images: (gif, jpg, png)", "gif", [gif => "gif", jpg => "jpg", 
png => "png"]],
-  [PF_TOGGLE, "separate", "Use a separate directory for images?",0],
+  [PF_TOGGLE, "separate", "Use a separate directory for images",0],
   [PF_STRING, "imgpath", "The path to export the images to, relative to the Save Path", "images/"],
-  [PF_TOGGLE, "capitalize_tags", "Capatalize HTML tags?", 0],
+  [PF_TOGGLE, "capitalize_tags", "Capitalize HTML tags", 0],
   [PF_SPINNER, "cellspacing", "Add space between the table elements", 0, [0,15,1]],
 
 =head1 IMAGE TYPES
diff --git a/examples/pixelmap b/examples/pixelmap
index 2a54c9e..15eecde 100755
--- a/examples/pixelmap
+++ b/examples/pixelmap
@@ -100,8 +100,8 @@ pixelgen/pixelmap - Generate the pixels of an image by expressions (in PDL)
 
 =head1 SYNOPSIS
 
-<Image>/File/Create/Logos/Pixelgenerator...
-<Image>/Filters/Generic/Pixelmap...
+  <Image>/File/Create/Logos/Pixelgenerator...
+  <Image>/Filters/Generic/Pixelmap...
 
 =head1 DESCRIPTION
 
diff --git a/examples/prep4gif b/examples/prep4gif
index e01cf6c..c81f680 100755
--- a/examples/prep4gif
+++ b/examples/prep4gif
@@ -65,10 +65,10 @@ transparent text doesn't look blocky.
 
 =head1 PARAMETERS
 
- [PF_INT32, "threshold", "Lower Alpha Threshold", 64],
- [PF_INT32, "growth", "How Much growth for safety ",1],
- [PF_TOGGLE, "index", "Convert Image to indexed", 0],
- [PF_TOGGLE, "dither", "Floyd-Steinberg Dithering?", 1],
+ [PF_INT32, "threshold", "Lower alpha threshold", 64],
+ [PF_INT32, "growth", "How much growth for safety ",1],
+ [PF_TOGGLE, "index", "Convert image to indexed", 0],
+ [PF_TOGGLE, "dither", "Floyd-Steinberg dithering", 1],
  [PF_INT32, "colors", "Colors to quantize to", "255"],
 
 =head1 IMAGE TYPES
diff --git a/examples/randomart1 b/examples/randomart1
index 719c712..2abfd94 100755
--- a/examples/randomart1
+++ b/examples/randomart1
@@ -98,13 +98,13 @@ Create a tileable image by repeatedly drawing colourful polygons
 
 =head1 PARAMETERS
 
-  [PF_INT32,   'width',        'Image Width',          300],
-  [PF_INT32,   'height',       'Image Height',         300],
-  [PF_SLIDER,  'num_poly',     'Number of Polygons',   20, [5,100,1]],
-  [PF_SLIDER,  'edges',        'Number of Edges',      10, [3, 30, 1]],
-  [PF_SLIDER,  'revolutions',  'Number of Revolutions',1, [1, 3, 1]],
-  [PF_SLIDER,  'feather',      'Feather Radius',       30, [1, 100]],
-  [PF_BOOL,    'super',        'Adaptive Supersampling?', 0],
+  [PF_INT32,   'width',        'Image width',          300],
+  [PF_INT32,   'height',       'Image height',         300],
+  [PF_SLIDER,  'num_poly',     'Number of polygons',   20, [5,100,1]],
+  [PF_SLIDER,  'edges',        'Number of edges',      10, [3, 30, 1]],
+  [PF_SLIDER,  'revolutions',  'Number of revolutions',1, [1, 3, 1]],
+  [PF_SLIDER,  'feather',      'Feather radius',       30, [1, 100]],
+  [PF_BOOL,    'super',        'Adaptive supersampling', 0],
 
 =head1 AUTHOR
 
diff --git a/examples/randomblends b/examples/randomblends
index 4f76b40..39a5a77 100755
--- a/examples/randomblends
+++ b/examples/randomblends
@@ -48,7 +48,7 @@ __END__
 
 =head1 NAME
 
-random_blends - Random Blends - Perform N random blends
+random_blends - Perform N random blends
 
 =head1 SYNOPSIS
 
diff --git a/examples/selective_sharpen b/examples/selective_sharpen
index 2228c00..d393169 100755
--- a/examples/selective_sharpen
+++ b/examples/selective_sharpen
@@ -7,61 +7,61 @@ use strict;
 # Gimp::set_trace(TRACE_ALL);
 
 podregister {
-    # sanity stuff
-    die "Can only operate on layers" unless $drawable->is_layer;
-    $drawable->become('Gimp::Layer');
+  # sanity stuff
+  die "Can only operate on layers" unless $drawable->is_layer;
+  $drawable->become('Gimp::Layer');
 
-    $image->undo_group_start;
+  $image->undo_group_start;
 
-    my @selbounds = $image->selection_bounds;
-    $image->selection_all if $selbounds[0] == 0;
+  my @selbounds = $image->selection_bounds;
+  $image->selection_all if $selbounds[0] == 0;
 
-    my $saved_selection = $image->selection_save;
-    $image->selection_none;
+  my $saved_selection = $image->selection_save;
+  $image->selection_none;
 
-    # 1) take the original photo, duplicate the layer
-    my $edge_layer = $drawable->Gimp::Layer::copy(1);
-    $image->insert_layer($edge_layer,0,-1);
+  # 1) take the original photo, duplicate the layer
+  my $edge_layer = $drawable->Gimp::Layer::copy(1);
+  $image->insert_layer($edge_layer,0,-1);
 
-    # 2) convert the copy to grayscale
-    $edge_layer->desaturate;
+  # 2) convert the copy to grayscale
+  $edge_layer->desaturate;
 
-    # 3) run edge detect to the gray layer (default works)
-    $edge_layer->edge(2.0, 2, 0);
+  # 3) run edge detect to the gray layer (default works)
+  $edge_layer->edge(2.0, 2, 0);
 
-    # 4) blur it slightly
-    $edge_layer->gauss_iir2(3.0, 3.0);
+  # 4) blur it slightly
+  $edge_layer->gauss_iir2(3.0, 3.0);
 
-    # 5) boost contrast (I can give you a specific curve or such)
-    $edge_layer->curves_spline(HISTOGRAM_VALUE,
-                             [0,0,
-                              45,20,
-                              160,225,
-                              255,255]
-                             );
+  # 5) boost contrast (I can give you a specific curve or such)
+  $edge_layer->curves_spline(HISTOGRAM_VALUE,
+                           [0,0,
+                            45,20,
+                            160,225,
+                            255,255]
+                           );
 
-    # 6) then make the boosted, gray edge-detection into a selection mask
-    my $selchan = $image->channel_new($image->width, $image->height, "sharpen_mask",
-                     100.0, [1.0,0,0]);
+  # 6) then make the boosted, gray edge-detection into a selection mask
+  my $selchan = $image->channel_new($image->width, $image->height, "sharpen_mask",
+                   100.0, [1.0,0,0]);
 
-    $image->insert_channel($selchan, 0, -1);
-    $edge_layer->edit_copy;
-    $selchan->edit_paste(1);
-    $image->get_floating_sel->anchor;
-    $selchan->combine_masks($saved_selection, CHANNEL_OP_INTERSECT, 0, 0);
-    $selchan->selection_load;
+  $image->insert_channel($selchan, 0, -1);
+  $edge_layer->edit_copy;
+  $selchan->edit_paste(1);
+  $image->get_floating_sel->anchor;
+  $selchan->combine_masks($saved_selection, CHANNEL_OP_INTERSECT, 0, 0);
+  $selchan->selection_load;
 
-    # 7) then use unsharp mask to that selection (scratch the gray layer)
-    $drawable->unsharp_mask($sharpen_radius, $sharpen_amt, $threshold);
+  # 7) then use unsharp mask to that selection (scratch the gray layer)
+  $drawable->unsharp_mask($sharpen_radius, $sharpen_amt, $threshold);
 
-    # cleanup
-    $saved_selection->selection_load;
-    $image->remove_channel($saved_selection);
-    $image->remove_channel($selchan);
-    $image->remove_layer($edge_layer);
+  # cleanup
+  $saved_selection->selection_load;
+  $image->remove_channel($saved_selection);
+  $image->remove_channel($selchan);
+  $image->remove_layer($edge_layer);
 
-    $image->undo_group_end;
-    ();
+  $image->undo_group_end;
+  ();
 };
 
 exit main;
diff --git a/examples/sethspin b/examples/sethspin
index c00a430..f31774c 100755
--- a/examples/sethspin
+++ b/examples/sethspin
@@ -123,12 +123,12 @@ another image.  I made it for easy web buttons.
 
 =head1 PARAMETERS
 
-  [PF_DRAWABLE, "destination","What drawable to spin to?"],
-  [PF_INT8, "frames", "How many frames to use?", 16],
-  [PF_COLOR, "color", "What color to use for background if not transparent", [0,0,0]],
+  [PF_DRAWABLE, "destination","Drawable to spin to"],
+  [PF_INT8, "frames", "How many frames to use", 16],
+  [PF_COLOR, "color", "Color to use for background if not transparent", [0,0,0]],
   [PF_SLIDER, "perspective", "How much perspective effect to get", 40, [0,255,5]],
-  [PF_TOGGLE, "spinback", "Also spin back?" , 1],
-  [PF_TOGGLE, "indexed", "Convert to indexed?", 1],
+  [PF_TOGGLE, "spinback", "Spin back" , 1],
+  [PF_TOGGLE, "indexed", "Convert to indexed", 1],
 
 =head1 IMAGE TYPES
 
diff --git a/examples/stampify b/examples/stampify
index 8a3011f..2aad9b1 100755
--- a/examples/stampify
+++ b/examples/stampify
@@ -1,73 +1,90 @@
 #!/usr/bin/perl
 
-eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
-    if 0; # not running under some shell
-
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 
 #Gimp::set_trace(TRACE_ALL);
 
-register       "stampify",
-               "Makes an image look like a postage stamp.",
-               "This plug-in works from the active layer. Depending on the size of the image, perforations 
may look strange. Test alternatives!",
-               "Claes G Lindblad <claesg\ algonet se>",
-               "Claes G Lindblad <claesg\ algonet se>",
-               "990328",
-               N_"<Image>/Filters/Render/Stampify...",
-               "*",
-               [
-       [PF_COLOR, "paper", "Paper colour", [242, 242, 242]],
-       [PF_COLOR, "hole", "Hole colour", [0, 0, 0]],
-       [PF_INT32, "diameter", "Diameter of perforation", 10],
-       [PF_INT32, "gap", "Gap between perforations", 5],
-       [PF_INT32, "marg", "Marginal between art and perforations", 7]
-               ],
-       sub {
-               my ($img, $drawable, $paper, $hole, $diameter, $gap, $marg) = @_;
-               $nw = int(gimp_image_width($img) + 2 * $marg + $diameter);
-               $nh = int(gimp_image_height($img) + 2 * $marg + $diameter);
-               my $img2 = gimp_image_new($nw, $nh, RGB);
-               my $layer1 = gimp_layer_new($img2, $nw, $nh, RGBA_IMAGE, "Layer 1", 100, NORMAL_MODE);
-               gimp_image_insert_layer($img2, $layer1, 0, 0);
-               gimp_image_set_active_layer($img2, $layer1);
-               gimp_context_set_background($paper);
-               gimp_drawable_fill($layer1, 1);
+podregister {
+  $nw = int(gimp_image_width($image) + 2 * $marg + $diameter);
+  $nh = int(gimp_image_height($image) + 2 * $marg + $diameter);
+  my $img2 = gimp_image_new($nw, $nh, RGB);
+  my $layer1 = gimp_layer_new($img2, $nw, $nh, RGBA_IMAGE, "Layer 1", 100, NORMAL_MODE);
+  gimp_image_insert_layer($img2, $layer1, 0, 0);
+  gimp_image_set_active_layer($img2, $layer1);
+  gimp_context_set_background($paper);
+  gimp_drawable_fill($layer1, 1);
 # create horisontal holes
-               gimp_selection_none($img2);
-               my $nholes = int (($nw + $gap) / ($diameter + $gap) + 0.5);
-               $pos = 0;
-               for ($i = 0; $i<$nholes; $i++) {
-                       gimp_image_select_ellipse($img2,
-                               CHANNEL_OP_ADD, $pos, 0,
-                               $diameter, $diameter,
-                               );
-                       $pos = $pos + $diameter + $gap;
-               }
+  gimp_selection_none($img2);
+  my $nholes = int (($nw + $gap) / ($diameter + $gap) + 0.5);
+  $pos = 0;
+  for ($i = 0; $i<$nholes; $i++) {
+    gimp_image_select_ellipse($img2,
+      CHANNEL_OP_ADD, $pos, 0,
+      $diameter, $diameter,
+    );
+    $pos = $pos + $diameter + $gap;
+  }
 # create vertical holes
-               $pos = 0;
-               for ($i = 0; $i<$nholes; $i++) {
-                       gimp_image_select_ellipse($img2,
-                               CHANNEL_OP_ADD, 0, $pos,
-                               $diameter, $diameter,
-                               );
-                       $pos = $pos + $diameter + $gap;
-               }
-               gimp_context_set_background($hole);
-               gimp_edit_fill($layer1, BACKGROUND_FILL);
-               gimp_selection_none($img2);
+  $pos = 0;
+  for ($i = 0; $i<$nholes; $i++) {
+    gimp_image_select_ellipse(
+      $img2, CHANNEL_OP_ADD, 0, $pos,
+      $diameter, $diameter,
+    );
+    $pos = $pos + $diameter + $gap;
+  }
+  gimp_context_set_background($hole);
+  gimp_edit_fill($layer1, BACKGROUND_FILL);
+  gimp_selection_none($img2);
 # here comes the clever part! :-)
 # offset horis and vert holes by half the diameter
-               gimp_drawable_offset($layer1, 1, 0, -($diameter / 2), -($diameter / 2));
-# insert $img into a new layer in $img2
-#              gimp_selection_all($img);
-               gimp_edit_copy($drawable);
-               my $float = gimp_edit_paste($layer1, 0);
-               gimp_floating_sel_anchor($float);
+  gimp_drawable_offset($layer1, 1, 0, -($diameter / 2), -($diameter / 2));
+# insert $image into a new layer in $img2
+#              gimp_selection_all($image);
+  gimp_edit_copy($drawable);
+  my $float = gimp_edit_paste($layer1, 0);
+  gimp_floating_sel_anchor($float);
 # and return command to The Gimp.
-               return $img2;
-       };
+  return $img2;
+};
 exit main;
+__END__
+
+=head1 NAME
+
+stampify - Makes an image look like a postage stamp.
+
+=head1 SYNOPSIS
+
+<Image>/Filters/Render/Stampify...
+
+=head1 DESCRIPTION
+
+This plug-in works from the active layer. Depending on the size of the
+image, perforations may look strange. Test alternatives!
+
+=head1 PARAMETERS
+
+  [PF_COLOR, "paper", "Paper colour", [242, 242, 242]],
+  [PF_COLOR, "hole", "Hole colour", [0, 0, 0]],
+  [PF_INT32, "diameter", "Diameter of perforation", 10],
+  [PF_INT32, "gap", "Gap between perforations", 5],
+  [PF_INT32, "marg", "Marginal between art and perforations", 7]
+
+=head1 RETURN VALUES
+
+=head1 IMAGE TYPES
+
+*
+
+=head1 AUTHOR
+
+Claes G Lindblad <claesg algonet se>
+
+=head1 DATE
+
+990328
 
 =head1 LICENSE
 
diff --git a/examples/stamps b/examples/stamps
index 5d0254e..40484f1 100755
--- a/examples/stamps
+++ b/examples/stamps
@@ -46,11 +46,11 @@ Default values are not bad!
 
 =head1 PARAMETERS
 
-  [PF_INT32, "size", "img size", 90],
-  [PF_COLOR, "paper", "paper color", [255, 255, 255]],
-  [PF_COLOR, "hole", "hole color", [0, 0, 0]],
-  [PF_INT32, "diameter", "diameter", 10],
-  [PF_INT32, "gap", "gap", 5]
+  [PF_INT32, "size", "Image size", 90],
+  [PF_COLOR, "paper", "Paper color", [255, 255, 255]],
+  [PF_COLOR, "hole", "Hole color", [0, 0, 0]],
+  [PF_INT32, "diameter", "Diameter", 10],
+  [PF_INT32, "gap", "Gap", 5]
 
 =head1 AUTHOR
 
diff --git a/examples/tex-to-float b/examples/tex-to-float
index 197509d..a5273ac 100755
--- a/examples/tex-to-float
+++ b/examples/tex-to-float
@@ -1,190 +1,183 @@
 #!/usr/bin/perl
 
-######################################################################
-#  A Perl::Fu plugin for converting TeX strings to floating layers.
-#
-#  Author: Dov Grobgeld
-#  Version: 0.13 for Gimp-2.0
-######################################################################
-
 use Gimp qw(:auto N_);
 use Gimp::Fu;
 
 my $fn_base = "/tmp/ttf$$";
 my %tmpfiles = (
-               "$fn_base.pgm"=>1,
-               "$fn_base.tex"=>1,
-               "$fn_base.log"=>1,
-               "$fn_base.ps"=>1,
-               "$fn_base.dvi"=>1);
+  "$fn_base.pgm"=>1,
+  "$fn_base.tex"=>1,
+  "$fn_base.log"=>1,
+  "$fn_base.ps"=>1,
+  "$fn_base.dvi"=>1);
 
 # Cleanup
 sub cleanup {
-    foreach my $fn (keys %tmpfiles) {
-       unlink $fn;
-    }
+  foreach my $fn (keys %tmpfiles) {
+    unlink $fn;
+  }
 }
 
 sub xec {
-    my $cmd = shift;
+  my $cmd = shift;
 #    print STDERR "$cmd\n";
-    return `$cmd`;
+  return `$cmd`;
 }
 
 sub exist_in_tex_path {
-    my $file = shift;
-
-    return 0 unless length($file);
-    return 1 if -e $file;
-    foreach my $p (split(/:/, $ENV{TEXINPUTS} . ":/tmp")) {
-       return 1 if -e "$p/$file";
-    }
-    return 0;
+  my $file = shift;
+
+  return 0 unless length($file);
+  return 1 if -e $file;
+  foreach my $p (split(/:/, $ENV{TEXINPUTS} . ":/tmp")) {
+      return 1 if -e "$p/$file";
+  }
+  return 0;
 }
 
 sub tex_string_to_pgm {
-    my($text, $input_file, $string, $ppi, $magstep, $anti_aliasing,
-       $output_file) = @_;
-
-    my $scale = sprintf("%.5f", 1/$anti_aliasing);
-    my $r = $ppi * $anti_aliasing;
-    my $device = "pgmraw";
-
-    chdir "/tmp";
-    if (exist_in_tex_path($input_file)) {
-       $input .= "\\input $input_file\n";
-    }
-
-    open(TEX, ">$fn_base.tex");
-    print TEX "\\nopagenumbers\n"
-           . "\\magnification\\magstep$magstep\n"
-           . "\\tolerance=8000\n"
-           . "$input\n"
-           . "$string\n"
-            . "\\bye";
-    close(TEX);
-
-    my $res = xec("tex $fn_base.tex");
-    # Deal with errors...
-
-    # Make dvips output bounding box
-    my $psoutput = xec("dvips -r$r -E -f $fn_base");
-    # Deal with errors
-
-    # Shift postscript file to origin
-    my @bbox = $psoutput=~ /^%%BoundingBox:\s*(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/m;
-    my $w = $bbox[2]-$bbox[0];
-    my $h = $bbox[3]-$bbox[1];
-    $psoutput=~ s/^%%BoundingBox:.*$/%%BoundingBox: 0 0 $w $h/m;
-    $psoutput=~ s/\b1 0 bop/-$bbox[0] -$bbox[1] translate\n$&/m;
-
-    # Output to file in order not to have to use Open2.
-    open(PS, ">$fn_base.ps");
-    print PS $psoutput;
-    close(PS);
-    $w= int($w*$r/72+0.5);
-    $h= int($h*$r/72+0.5);
-
-    # Use gs to produce a pgmfile
-    my $cmd = "gs -g${w}x${h} -r${r} -dNOPAUSE -q -sDEVICE=$device -sOutputFile=- $fn_base.ps quit.ps |";
-    $cmd .= "pnmscale $scale |" if $scale != 1;
-    chop($cmd);
-    $cmd .= "> $output_file";
-    print "$cmd\n";
-    xec("$cmd");
+  my($text, $input_file, $string, $ppi, $magstep, $anti_aliasing,
+     $output_file) = @_;
+
+  my $scale = sprintf("%.5f", 1/$anti_aliasing);
+  my $r = $ppi * $anti_aliasing;
+  my $device = "pgmraw";
+
+  chdir "/tmp";
+  if (exist_in_tex_path($input_file)) {
+    $input .= "\\input $input_file\n";
+  }
+
+  open(TEX, ">$fn_base.tex");
+  print TEX "\\nopagenumbers\n"
+         . "\\magnification\\magstep$magstep\n"
+         . "\\tolerance=8000\n"
+         . "$input\n"
+         . "$string\n"
+         . "\\bye";
+  close(TEX);
+
+  my $res = xec("tex $fn_base.tex");
+  # Deal with errors...
+
+  # Make dvips output bounding box
+  my $psoutput = xec("dvips -r$r -E -f $fn_base");
+  # Deal with errors
+
+  # Shift postscript file to origin
+  my @bbox = $psoutput=~ /^%%BoundingBox:\s*(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/m;
+  my $w = $bbox[2]-$bbox[0];
+  my $h = $bbox[3]-$bbox[1];
+  $psoutput=~ s/^%%BoundingBox:.*$/%%BoundingBox: 0 0 $w $h/m;
+  $psoutput=~ s/\b1 0 bop/-$bbox[0] -$bbox[1] translate\n$&/m;
+
+  # Output to file in order not to have to use Open2.
+  open(PS, ">$fn_base.ps");
+  print PS $psoutput;
+  close(PS);
+  $w= int($w*$r/72+0.5);
+  $h= int($h*$r/72+0.5);
+
+  # Use gs to produce a pgmfile
+  my $cmd = "gs -g${w}x${h} -r${r} -dNOPAUSE -q -sDEVICE=$device -sOutputFile=- $fn_base.ps quit.ps |";
+  $cmd .= "pnmscale $scale |" if $scale != 1;
+  chop($cmd);
+  $cmd .= "> $output_file";
+  print "$cmd\n";
+  xec("$cmd");
 }
 
 sub grey_file_to_float {
-    my($img1, $drw1, $fn) = @_;
-
-    # Setup
-    gimp_image_undo_group_start($img1);
-    gimp_context_push();
-
-    # Load the new img
-    my $grey_img = gimp_file_load($fn, $fn);
-
-    # Get name of new layer
-    my $grey_layer = gimp_image_get_active_layer($grey_img);
-
-    # Create an alpha layer and copy image to alpha layer
-    gimp_layer_add_alpha($grey_layer);
-    $grey_img->selection_all();
-    gimp_edit_copy($grey_layer);
-    $mask = gimp_layer_create_mask($grey_layer, 0);
-    gimp_layer_add_mask($grey_layer, $mask);
-    my $floating_layer = gimp_edit_paste($mask, 0);
-    gimp_floating_sel_anchor($floating_layer);
-    gimp_invert($mask);
-    gimp_context_set_background(gimp_context_get_foreground());
-    gimp_edit_fill($grey_layer, BACKGROUND_FILL);
-    gimp_layer_remove_mask($grey_layer, 0);
-
-    # Now copy this layer to $img 1
-    gimp_edit_copy($grey_layer);
-    $floating_layer = gimp_edit_paste($drw1, 0);
-    if (gimp_version() gt "2.3")  # make work for 2.2 or 2.3
-      { gimp_layer_set_lock_alpha($floating_layer, 1); }
-    else
-      { gimp_layer_set_lock_alpha($floating_layer,1); }
-    gimp_edit_fill($floating_layer, BACKGROUND_FILL);
-
-    cleanup();
-
-    # Get rid of $grey_img
-    gimp_image_delete($grey_img);
-
-    # Restore
-    gimp_context_pop();
-    gimp_image_undo_group_end($img1);
-
-    # Update the display
-    gimp_displays_flush();
-
-    return undef;
+  my($image, $drawable, $fn) = @_;
+
+  # Setup
+  gimp_image_undo_group_start($image);
+  gimp_context_push();
+
+  # Load the new img
+  my $grey_img = gimp_file_load($fn, $fn);
+
+  # Get name of new layer
+  my $grey_layer = gimp_image_get_active_layer($grey_img);
+
+  # Create an alpha layer and copy image to alpha layer
+  gimp_layer_add_alpha($grey_layer);
+  $grey_img->selection_all();
+  gimp_edit_copy($grey_layer);
+  $mask = gimp_layer_create_mask($grey_layer, 0);
+  gimp_layer_add_mask($grey_layer, $mask);
+  my $floating_layer = gimp_edit_paste($mask, 0);
+  gimp_floating_sel_anchor($floating_layer);
+  gimp_invert($mask);
+  gimp_context_set_background(gimp_context_get_foreground());
+  gimp_edit_fill($grey_layer, BACKGROUND_FILL);
+  gimp_layer_remove_mask($grey_layer, 0);
+
+  # Now copy this layer to $img 1
+  gimp_edit_copy($grey_layer);
+  $floating_layer = gimp_edit_paste($drawable, 0);
+  gimp_layer_set_lock_alpha($floating_layer, 1);
+  gimp_edit_fill($floating_layer, BACKGROUND_FILL);
+
+  cleanup();
+
+  # Get rid of $grey_img
+  gimp_image_delete($grey_img);
+
+  # Restore
+  gimp_context_pop();
+  gimp_image_undo_group_end($image);
+
+  return undef;
 }
 
+podregister {
+  tex_string_to_pgm($text, $input_file, $text, $ppi, $magstep, $anti_aliasing,
+                   "$fn_base.pgm");
+  grey_file_to_float($image, $drawable, "$fn_base.pgm");
+  ();
+};
+
+exit main();
+__END__
 
-sub tex_string_to_float {
-    my($img1, $drw1,
-       $input_file,
-       $text,
-       $ppi,
-       $magstep,
-       $anti_aliasing) = @_;
+=head1 NAME
 
+tex_string_to_float - Turn a TeX-string into floating layer
 
-    tex_string_to_pgm($text, $input_file, $text, $ppi, $magstep, $anti_aliasing,
-                     "$fn_base.pgm");
+=head1 SYNOPSIS
 
-    grey_file_to_float($img1, $drw1, "$fn_base.pgm");
+<Image>/Filters/Render/TeX String...
 
-    return undef;
-}
+=head1 DESCRIPTION
+
+Takes a TeX string as input and creates a floating layer of the rendered
+string in the current layer in the foreground color.
+
+=head1 PARAMETERS
 
-# register the script
-register "tex_string_to_float", "Turn a TeX-string into floating layer", "Takes a TeX string as input and 
creates a floating layer of the rendered string in the current layer in the foreground color.",
-    "Dov Grobgeld <dov\ imagic weizmann ac il>", "Dov Grobgeld",
-    "1999-03-16",
-    N_"<Image>/Filters/Render/TeX String...",
-    "*",
-    [
      [PF_STRING,  "input_file",     "TeX macro file to input"],
-     [PF_STRING,  "tex_string",     "Enter TeX String", "Your \\TeX string here"],
-     [PF_VALUE,   "dpi",     "Resolution to render the text in",   "72"],
+     [PF_STRING,  "text",     "Enter TeX String", "Your \\TeX string here"],
+     [PF_VALUE,   "ppi",     "Resolution to render the text in",   "72"],
      [PF_VALUE,   "magstep",     "TeX magstep",   "2"],
      [PF_VALUE,   "anti_aliasing",     "Anti-aliasing factor",   "4"],
-    ],
-    \&tex_string_to_float;
 
-# Handle over control to gimp
-exit main();
+=head1 RETURN VALUES
+
+=head1 IMAGE TYPES
+
+*
+
+=head1 AUTHOR
+
+Dov Grobgeld <dov imagic weizmann ac il>
+
+=head1 DATE
+
+1999-03-16
 
 =head1 LICENSE
 
 (c) Dov Grobgeld
 
 Released under the Artistic License.
-
-=cut
-
diff --git a/examples/translogo b/examples/translogo
index d884539..f449e5e 100755
--- a/examples/translogo
+++ b/examples/translogo
@@ -89,8 +89,8 @@ and index it.  The original image is untouched.
 
  [PF_RADIO, 'rad_tog', 'Use a colour or a pattern for text', 0,
     [Colour => 0, Pattern => 1]],
- [PF_PATTERN, 'pattern', "Choose the text pattern", "Wood #1"],
- [PF_COLOUR, 'txt_col', "Choose the text color", [69, 88, 211]],
+ [PF_PATTERN, 'pattern', "Text pattern", "Wood #1"],
+ [PF_COLOUR, 'txt_col', "Text color", [69, 88, 211]],
 
 =head1 IMAGE TYPES
 
diff --git a/examples/triangle b/examples/triangle
index d1610e4..9edf5bb 100755
--- a/examples/triangle
+++ b/examples/triangle
@@ -1,48 +1,62 @@
 #!/usr/bin/perl
 
-eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
-    if 0; # not running under some shell
-
 use Gimp qw(:auto __ N_);
 use Gimp::Fu;
 
-register       "triangle",
-               "Creates a triangular selection with the diagonal as one of its sides.",
-               "Tick appropriate radio buttons.",
-               "Claes G Lindblad <claesg\ algonet se>",
-               "Claes G Lindblad <claesg\ algonet se>",
-               "990328",
-               N_"<Image>/Select/Triangle...",
-               "*",
-               [
-               [PF_RADIO, "type", "Select position", 0,
-                       [Upper_left => 0, Lower_left => 1, Upper_right => 2, Lower_right => 3]
-               ],
-               [PF_RADIO, "mode", "Selection mode", 2,
-                       [Add => 0, Subtract => 1, Replace => 2, Intersect => 3]
-               ]
-               ],
-       sub {
-               my ($img, $layer, $type, $mode) = @_;
-
-               $w = $img->width();
-               $h = $img->height();
-
-               if ($type == 0) {
-                       $lista= [0, 0, $w, 0, 0, $h, 0, 0];
-               };
-               if ($type == 1) {
-                       $lista= [0, 0, 0, $h, $w, $h, 0, 0];
-               };
-               if ($type == 2) {
-                       $lista= [0, 0, $w, 0, $w, $h, 0, 0];
-               };
-               if ($type == 3) {
-                       $lista= [$w, 0, $w, $h, 0, $h, $w, 0];
-               };
-               $img->select_polygon($mode, $lista);
-       };
+podregister {
+  $w = $image->width();
+  $h = $image->height();
+  if ($type == 0) {
+    $lista= [0, 0, $w, 0, 0, $h, 0, 0];
+  };
+  if ($type == 1) {
+    $lista= [0, 0, 0, $h, $w, $h, 0, 0];
+  };
+  if ($type == 2) {
+    $lista= [0, 0, $w, 0, $w, $h, 0, 0];
+  };
+  if ($type == 3) {
+    $lista= [$w, 0, $w, $h, 0, $h, $w, 0];
+  };
+  $image->select_polygon($mode, $lista);
+};
 exit main;
+__END__
+
+=head1 NAME
+
+triangle - Creates a triangular selection with the diagonal as one of its sides.
+
+=head1 SYNOPSIS
+
+<Image>/Select/Triangle...
+
+=head1 DESCRIPTION
+
+Tick appropriate radio buttons.
+
+=head1 PARAMETERS
+
+  [PF_RADIO, "type", "Select position", 0,
+    [Upper_left => 0, Lower_left => 1, Upper_right => 2, Lower_right => 3]
+  ],
+  [PF_RADIO, "mode", "Selection mode", 2,
+    [Add => 0, Subtract => 1, Replace => 2, Intersect => 3]
+  ]
+
+=head1 RETURN VALUES
+
+=head1 IMAGE TYPES
+
+*
+
+=head1 AUTHOR
+
+Claes G Lindblad <claesg algonet se>
+
+=head1 DATE
+
+990328
 
 =head1 LICENSE
 
diff --git a/examples/view3d b/examples/view3d
index 7ea1a47..453088b 100755
--- a/examples/view3d
+++ b/examples/view3d
@@ -5,24 +5,11 @@ use Gimp::Fu;
 use PDL;
 use PDL::Graphics::TriD;
 
-register
-    'view3d',
-    'View grayscale drawable in 3D',
-    'This script uses PDL::Graphics:TriD to view a grayscale drawable in 3D. You can choose a Cartesian 
(default) or Polar projection, toggle the drawing of lines, and toggle normal smoothing.',
-    'Tom Rathborne', 'GPLv2', '1999-03-11',
-    N_"<Image>/View/3D Surface...",
-    'RGB*,GRAY*', [
-        [ PF_BOOL, 'polar', 'Radial view', 0],
-        [ PF_BOOL, 'lines', 'Draw grid lines', 0],
-        [ PF_BOOL, 'smooth', 'Smooth surface normals', 1]
-    ], [],
-sub {
-    my ($img, $dwb, $polar, $lines, $smooth) = @_;
+podregister {
+    my $w = $drawable->width;
+    my $h = $drawable->height;
 
-    my $w = $dwb->width;
-    my $h = $dwb->height;
-
-    my $regn = $dwb->pixel_rgn (0, 0, $w, $h, 0, 0);
+    my $regn = $drawable->pixel_rgn (0, 0, $w, $h, 0, 0);
     my $surf = $regn->get_rect (0, 0, $w, $h);
     $surf=$surf->slice("(0)");
 
@@ -33,11 +20,42 @@ sub {
 };
 
 exit main;
+__END__
 
-=head1 LICENSE
+=head1 NAME
 
-(c) Tom Rathborne
+view3d - View grayscale drawable in 3D
 
-Released under the GNU Public License v2.
+=head1 SYNOPSIS
+
+<Image>/View/3D Surface...
+
+=head1 DESCRIPTION
+
+This script uses PDL::Graphics:TriD to view a grayscale drawable in
+3D. You can choose a Cartesian (default) or Polar projection, toggle
+the drawing of lines, and toggle normal smoothing.
+
+=head1 PARAMETERS
+
+        [ PF_BOOL, 'polar', 'Radial view', 0],
+        [ PF_BOOL, 'lines', 'Draw grid lines', 0],
+        [ PF_BOOL, 'smooth', 'Smooth surface normals', 1]
+
+=head1 RETURN VALUES
+
+=head1 IMAGE TYPES
+
+RGB*,GRAY*
+
+=head1 AUTHOR
 
-=cut
+Tom Rathborne
+
+=head1 DATE
+
+1999-03-11
+
+=head1 LICENSE
+
+Released under the GNU Public License v2.
diff --git a/examples/webify b/examples/webify
index c36b8a6..b8bbe06 100755
--- a/examples/webify
+++ b/examples/webify
@@ -35,16 +35,18 @@ webify - Make an image suitable for the web
 
 =head1 DESCRIPTION
 
-This plug-in converts the image to indexed, with some extra options.
+Flattens an image, makes the background transparent, converts it to
+indexed and then crops it to the right size. Useful to save small &
+transparent gifs from a higher-quality source.
 
 =head1 PARAMETERS
 
-  [PF_BOOL, "new", "Create a new image?", 1],
-  [PF_BOOL, "alpha", "Make transparent?", 1],
+  [PF_BOOL, "new", "Create a new image", 1],
+  [PF_BOOL, "alpha", "Make transparent", 1],
   [PF_COLOUR, "bg", "Background colour to use for transparency", "white"],
   [PF_SLIDER, "thresh", "Threshold to use for background detection", 3, [0, 255, 1]],
   [PF_INT32, "colours", "How many colours to use (0 = don't convert to indexed)", 32],
-  [PF_BOOL, "autocrop", "Autocrop at end?", 1],
+  [PF_BOOL, "autocrop", "Autocrop at end", 1],
 
 =head1 RETURN VALUES
 
diff --git a/examples/xachshadow b/examples/xachshadow
index b37fbb2..c865fc5 100755
--- a/examples/xachshadow
+++ b/examples/xachshadow
@@ -63,7 +63,7 @@ Screen of 50% of your drawing into a dropshadowed layer.
 
 =head1 PARAMETERS
 
-  [PF_SLIDER,  "blocksize",    "The size of the blocks...", 10, [4, 255, 1]],
+  [PF_SLIDER, "blocksize", "Size of blocks", 10, [4, 255, 1]],
 
 =head1 IMAGE TYPES
 
diff --git a/examples/xachvision b/examples/xachvision
index e4a4a39..4391103 100755
--- a/examples/xachvision
+++ b/examples/xachvision
@@ -47,8 +47,8 @@ Once again, an effect of Xach's.
 
 =head1 PARAMETERS
 
-  [PF_COLOR,   "color",        "What Color to see the world in", [0, 255, 0]],
-  [PF_SLIDER,   "amt", "How much noise to add", 25, [0,255,5]]
+  [PF_COLOR, "color", "Color to see the world in", [0, 255, 0]],
+  [PF_SLIDER, "amt", "How much noise to add", 25, [0,255,5]]
 
 =head1 IMAGE TYPES
 
diff --git a/examples/yinyang b/examples/yinyang
index 6d46cb6..d697d18 100755
--- a/examples/yinyang
+++ b/examples/yinyang
@@ -134,7 +134,7 @@ the other image.
   [PF_INT32, "width", "Width", 256],
   [PF_INT32, "height", "Height", 256],
   [PF_TOGGLE, 'do_eyes', "Insert eyes", 1],
-  [PF_TOGGLE, 'eye_images', "Eyes are images?", 0],
+  [PF_TOGGLE, 'eye_images', "Eyes are images", 0],
   [PF_FILE, 'white_eye_image', "Top eye filename", ""],
   [PF_FILE, 'black_eye_image', "Bottom eye filename", ""],
   [PF_TOGGLE, 'aa', "Anti-aliasing", 1]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]