make-img-map
Dov Grobgeld 1998
http://imagic.weizmann.ac.il/~dov/gimp

Download

Download the script gimp-make-img-map.

Make an image map from a list of images

SYNTAX

    gimp-make-img-map [-max_height mh] [-htmlindex hi] [-layoutwidth lw]
	         [-flatten] [-bgcolor clr] [-bgpattern ptn] list

DESCRIPTION

gimp-make-img-map communicates with Gimp through the Perl Net-Server and automizes the process of combining a list of images into an image map for use e.g. within a HTML page.

OPTIONS

-max_height mhSet max height of images. (Default 64)
-index ifCreate an index file mapping filename to bounding box coordinates in output image, where if is the name of the index file. The index file may e.g. be translated by a subsequent program into a html index file.
-layoutwidth lwSet total width of layout. (Default 600)
-flattenFlatten the final image.
-bgcolorSet bg color.
-bgpatternSet bg pattern. Overrides the bgcolor.
-padx pxExtra space around all images in x-direction. (Default 20)
-pady pyExtra space around all images in y-direction. (Default 20)
-gutterx gxSpace between images in x-direction. (Default 15)
-gutterx gySpace between images in y-direction. (Default 15)
-darkcomp Compensate for darkening when bumpmapping.
-decoration alg Choose algorithm for drawing the decoration in the layout. Known algorithms are:
  • drop-shadow
  • sunken-windows

EXAMPLES

  1. Given a text file myimg.list containing the names of four images of arbitrary sizes:
     red.png                               
     green.png
     blue.jpg
     pink.jpg
      gimp-make-img-map -bgcolor #440000 -layoutwidth 400 myimg.list
    creates the image:

  2. The following is a different set of parameters:
       gimp-make-img-map -index myindex.list -max_height 50 -bgpattern Wood \
           -decoration sunken-windows -darkcomp -layoutwidth 200 myimg.list      
    
    creates the image:

The list file

If the option -index index.idx is given then the following info is written to the file index.idx:
  red.png 22 20 178 70 
  green.png 55 85 105 135 
  blue.png 120 85 145 135 
  pink.png 62 150 138 200
This info can easily be converted into a html image map with a script similar to the following:
  #!/usr/local/bin/perl
  my $map = q(<map name="mymap">);

  my $idx = 0;
  while(<>) {
     ($img, $x0, $y0, $x1, $y1) = split;
     $map .= "<area shape=\"rect\" coords=\"$x0,$y0,$x1,$y1\" ".
             "href=\"img$idx.html\">\n";
     $idx++;
  }
  $map .= "</map>";
  print "$map";
  print "<img src=\"index.jpg\" usemap=\"#mymap\>\n";

Comments

I will be happy to receive ideas about additional layout algorithms and decorations that may be added to gimp-make-img-map.

Dov Grobgeld <dov@imagic.weizmann.ac.il>