The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

make-img-map - Make an image map from a list of images

SYNOPSIS

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

DESCRIPTION

This program is an automatic way of scaling and tiling lots of images in order to create an index image.

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

PARAMETERS

  Options:
    -max_height mh   Set max height of images. (Default $max_height)
    -index if        Create 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 lw  Set total width of layout. (Default $layout_width)
    -flatten         Flatten the final image.
    -bgcolor         Set bg color.
    -bgpattern       Set bg pattern. Overrides the bgcolor.
    -padx px         Extra space around all images in x-direction.
                     (Default $pad_x)
    -pady py         Extra space around all images in y-direction.
                     (Default $pad_y)
    -gutterx gx      Space between images in x-direction. (Default $gutter_x)
    -gutterx gy      Space between images in y-direction. (Default $gutter_y)
    -darkcomp        Compensate for darkening when bumpmapping.
    -decoration alg  Choose algorithm for drawing the decoration in the layout.
                     Known algorithms are:
                           drop-shadow
                           sunken-windows
                     Default is 'drop_shadow'.

EXAMPLES

Given a text file myimg.list containing the names of four images of arbitrary sizes:

 red.png                               
 green.png
 blue.jpg
 pink.jpg

Run:

 gimp-make-img-map -bgcolor #440000 -layoutwidth 400 myimg.list

An alternative command line:

 gimp-make-img-map -index myindex.list -max_height 50 -bgpattern Wood \
    -decoration sunken-windows -darkcomp -layoutwidth 200 myimg.list      

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";

BUGS

  -padx px means at least px and not exactly px. This should be fixed.

TODO

    - Add more layout algorithms. (fixed grid, dynamic grid, better
      orphan handling)
    - Add more decoration algorithms (e.g. negative strip, slides,
      sunken windows).
    - Create a way of supplying a template HTML index file into which
      the image map will be added.
    - Create a way of supplying a template HTML file in which
      full size images will be displayed. This file may include
      image annotations that come from the input file.
    - Define format of input file. This file should include
      annotations on/below images, comments in the full size html
      file, perhaps baloon text on top of images.
    - Make all parameters of tiling algorithms into options.
    - Change background of simple-shadow algorithm.
    - Option for either keeping image in gimp, or flattening and
      saving to disk.
    - Add a modular way of adding new layout and decoration algorithms.

AUTHOR

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

HISTORY

  Changes:
    0.13  * Replaced call to gimp_image_get_layers() with call to
            gimp_image_get_active_layer(), as the former was broken
            in Gimp-0.90 .
          * Made kludge to be able to print out my own help message.
    0.14  * Got rid of OO module which is no longer in use.

LICENSE

(c) Dov Grobgeld

Released under the Artistic license.