diff --git a/.gitattributes b/.gitattributes
index 1b5a41707c3a8614f6b2ca27fc3ec4ae3e976219..956820a4e65db3d35d4c7135d7e0867d858532e1 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -80,6 +80,7 @@ testfont binary
 /src/modules/Image/encodings/gif.c foreign_ident
 /src/modules/Image/encodings/gif_lzw.c foreign_ident
 /src/modules/Image/encodings/gif_lzw.h foreign_ident
+/src/modules/Image/encodings/pnm.c foreign_ident
 /src/modules/Image/font.c foreign_ident
 /src/modules/Image/illustration.pike foreign_ident
 /src/modules/Image/image.c foreign_ident
diff --git a/src/modules/Image/Makefile b/src/modules/Image/Makefile
index 170d51af6f6a721789203d94d520c8ebd9f02082..c90bc7ab71f233c213b8544aef1373d8e3e2a509 100644
--- a/src/modules/Image/Makefile
+++ b/src/modules/Image/Makefile
@@ -3,7 +3,7 @@ DOCFILES = doc-header \
    blit.c blit_layer_include.h colortable.c colortable.h dct.c font.c \
    image.c image.h lzw.c lzw.h matrix.c operator.c pattern.c pnm.c \
    polyfill.c quant.c togif.c x.c encodings/gif.c encodings/gif_lzw.c \
-   encodings/gif_lzw.h \
+   encodings/gif_lzw.h encodings/pnm.c \
    doc-footer
 
 pike=pike
diff --git a/src/modules/Image/Makefile.in b/src/modules/Image/Makefile.in
index 948d8599b191b5106e7ce3de3989b75f3c70c752..8e1971c8ade4deb08d641a830cb9792ebf16688c 100644
--- a/src/modules/Image/Makefile.in
+++ b/src/modules/Image/Makefile.in
@@ -4,7 +4,7 @@ OBJS = image.o font.o quant.o lzw.o togif.o matrix.o pnm.o blit.o \
 	pattern.o dct.o operator.o x.o colortable.o polyfill.o 
 MODNAME=image
 MODULE_SUBDIRS=encodings
-MODULE_ARCHIVES=encodings/gif.a
+MODULE_ARCHIVES=encodings/gif.a encodings/pnm.a
 MODULE_LDFLAGS=@LDFLAGS@
 
 @SET_MAKE@
diff --git a/src/modules/Image/doc/Image.PNM.html b/src/modules/Image/doc/Image.PNM.html
new file mode 100644
index 0000000000000000000000000000000000000000..b9435cea34cb1627e9ecdbbb269783018a826649
--- /dev/null
+++ b/src/modules/Image/doc/Image.PNM.html
@@ -0,0 +1,104 @@
+<title>Pike documentation: module Image.PNM</title>
+<h2>module Image.PNM</h2>
+
+
+<blockquote>
+This submodule keep the PNM encode/decode capabilities
+     of the <tt><a href=Image.html>Image</a></tt> module.
+
+<p>     PNM is a common image storage format on unix systems,
+     and is a very simple format.
+
+<p>     This format doesn't use any color palette.
+
+<p>     The format is divided into seven subformats;
+
+<p>     <pre>
+     P1(PBM) - ascii bitmap (only two colors)
+     P2(PGM) - ascii greymap (only grey levels)
+     P3(PPM) - ascii truecolor
+     P4(PBM) - binary bitmap 
+     P5(PGM) - binary greymap 
+     P6(PPM) - binary truecolor
+     </pre>
+</blockquote>
+
+
+<h4>SEE ALSO</h4>
+<blockquote>     <tt><a href=Image.html>Image</a></tt>,
+     <tt><a href=Image.html>Image.image</a></tt>,
+     <tt><a href=Image.html>Image.GIF</a></tt>
+</blockquote>
+
+<hr>
+<a name=decode> </a>
+<h4>SYNOPSIS</h4>
+<blockquote>
+<tt>object <b>decode</b>(string&nbsp;data)</tt>
+</blockquote>
+
+<h4>DESCRIPTION</h4>
+
+
+<blockquote>
+Decodes PNM (PBM/PGM/PPM) data and creates an image object.
+</blockquote>
+<h4>RETURNS</h4>
+
+
+<blockquote>
+the decoded image as an image object
+</blockquote>
+
+
+<h4>NOTE</h4>
+<blockquote>
+This function may throw errors upon illegal PNM data.
+</blockquote>
+
+
+<h4>SEE ALSO</h4>
+<blockquote>     <tt><a href=Image.PNM.html#::encode>encode</a></tt>
+</blockquote>
+
+<hr>
+<a name=encode> </a>
+<a name=encode_P6> </a>
+<a name=encode_binary> </a>
+<h4>SYNOPSIS</h4>
+<blockquote>
+<tt>string <b>encode</b>(object&nbsp;image)<br>
+string <b>encode_binary</b>(object&nbsp;image)<br>
+string <b>encode_P6</b>(object&nbsp;image)</tt>
+</blockquote>
+
+<h4>DESCRIPTION</h4>
+
+
+<blockquote>
+Make a complete PNM file from an image.
+
+<p>     <tt><a href=Image.PNM.html#::encode_binary>encode_binary</a></tt>() and <tt><a href=Image.PNM.html#::encode_ascii>encode_ascii</a></tt>()
+     uses the most optimized encoding for this image (bitmap, grey
+     or truecolor) - P4, P5 or P6 respective P1, P2 or P3.
+
+<p>     <tt><a href=Image.PNM.html#::encode>encode</a></tt>() maps to <tt><a href=Image.PNM.html#::encode_binary>encode_binary</a></tt>().
+</blockquote>
+<h4>RETURNS</h4>
+
+
+<blockquote>
+the encoded image as a string
+</blockquote>
+
+
+<h4>KNOWN BUGS</h4>
+<blockquote>
+Currently only supports type P5 (binary grey) and
+     P6 (binary truecolor).
+</blockquote>
+
+
+<h4>SEE ALSO</h4>
+<blockquote>     <tt><a href=Image.PNM.html#::decode>decode</a></tt>
+</blockquote>
diff --git a/src/modules/Image/doc/Image.colortable.html b/src/modules/Image/doc/Image.colortable.html
index 2a6d162bb1d5f8b1b48a0f0307e9999643c55a03..f54451c53bb302b59d28d0a7c4c16ae599dc6dfd 100644
--- a/src/modules/Image/doc/Image.colortable.html
+++ b/src/modules/Image/doc/Image.colortable.html
@@ -13,9 +13,9 @@ This object keeps colortable information,
 
 <h4>SEE ALSO</h4>
 <blockquote>     <tt><a href=Image.html>Image</a></tt>,
-     <tt><a href=Image.image.html>Image.image</a></tt>,
-     <tt><a href=Image.font.html>Image.font</a></tt>,
-     <tt><a href=Image.GIF.html>Image.GIF</a></tt>
+     <tt><a href=Image.html>Image.image</a></tt>,
+     <tt><a href=Image.html>Image.font</a></tt>,
+     <tt><a href=Image.html>Image.GIF</a></tt>
 </blockquote>
 
 <hr>
@@ -39,28 +39,36 @@ Map colors in an image object to the colors in
 
 <p>     <table><tr valign=center>
      <td></td>
-     <td><img src=illustration_0.gif width=67 height=67></td>
-     <td><img src=illustration_1.gif width=67 height=67></td>
-     <td><img src=illustration_2.gif width=67 height=67></td>
-     <td><img src=illustration_3.gif width=67 height=67></td>
-     <td><img src=illustration_4.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_0.gif><img border=0 src=illustration_0.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_1.gif><img border=0 src=illustration_1.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_2.gif><img border=0 src=illustration_2.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_3.gif><img border=0 src=illustration_3.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_4.gif><img border=0 src=illustration_4.gif width=67 height=67></a></td>
      <td>no dither</td>
      </tr><tr valign=center>
      <td></td>
-     <td><img src=illustration_5.gif width=67 height=67></td>
-     <td><img src=illustration_6.gif width=67 height=67></td>
-     <td><img src=illustration_7.gif width=67 height=67></td>
-     <td><img src=illustration_8.gif width=67 height=67></td>
-     <td><img src=illustration_9.gif width=67 height=67></td>
-     <td>floyd-steinberg dither</td>
+     <td><a href=illustrations.html#illustration_5.gif><img border=0 src=illustration_5.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_6.gif><img border=0 src=illustration_6.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_7.gif><img border=0 src=illustration_7.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_8.gif><img border=0 src=illustration_8.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_9.gif><img border=0 src=illustration_9.gif width=67 height=67></a></td>
+     <td><tt><a href=Image.html>floyd_steinberg</a></tt> dither</td>
+     </tr><tr valign=center>
+     <td></td>
+     <td><a href=illustrations.html#illustration_10.gif><img border=0 src=illustration_10.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_11.gif><img border=0 src=illustration_11.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_12.gif><img border=0 src=illustration_12.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_13.gif><img border=0 src=illustration_13.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_14.gif><img border=0 src=illustration_14.gif width=67 height=67></a></td>
+     <td><tt><a href=Image.html>ordered</a></tt> dither</td>
      </tr><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_11.gif width=67 height=67></td>
-     <td><img src=illustration_12.gif width=67 height=67></td>
-     <td><img src=illustration_13.gif width=67 height=67></td>
-     <td><img src=illustration_14.gif width=67 height=67></td>
-     <td><img src=illustration_15.gif width=67 height=67></td>
-     <td>randomcube dither</td>
+     <td><a href=illustrations.html#illustration_16.gif><img border=0 src=illustration_16.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_17.gif><img border=0 src=illustration_17.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_18.gif><img border=0 src=illustration_18.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_19.gif><img border=0 src=illustration_19.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_20.gif><img border=0 src=illustration_20.gif width=67 height=67></a></td>
+     <td><tt><a href=Image.html>randomcube</a></tt> dither</td>
      </tr><tr valign=center>
      <td>original</td>
      <td>2</td>
@@ -80,7 +88,7 @@ a new image object
 
 <h4>NOTE</h4>
 <blockquote>
-Flat (not cube) colortable and not '<tt><a href=Image.colortable.html#full>full</a></tt>' method: 
+Flat (not cube) colortable and not '<tt><a href=Image.html>full</a></tt>' method: 
      this method does figure out the data needed for
      the lookup method, which may take time the first
      use of the colortable - the second use is quicker.
@@ -88,8 +96,8 @@ Flat (not cube) colortable and not '<tt><a href=Image.colortable.html#full>full<
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.colortable.html#cubicles>cubicles</a></tt>,
-     <tt><a href=Image.colortable.html#full>full</a></tt>
+<blockquote>     <tt><a href=Image.html>cubicles</a></tt>,
+     <tt><a href=Image.html>full</a></tt>
 </blockquote>
 
 <hr>
@@ -108,7 +116,7 @@ sums colortables
 <h4>ARGUMENTS</h4>
 <blockquote><dl>
 <dt><tt>object(<ref>colortable</ref>) with</tt>
-  <dd><tt><a href=Image.colortable.html#colortable>colortable</a></tt> object with colors to add
+  <dd><tt><a href=Image.html>colortable</a></tt> object with colors to add
 </dl></blockquote>
 <h4>RETURNS</h4>
 
@@ -133,7 +141,7 @@ subtracts colortables
 <h4>ARGUMENTS</h4>
 <blockquote><dl>
 <dt><tt>object(<ref>colortable</ref>) with</tt>
-  <dd><tt><a href=Image.colortable.html#colortable>colortable</a></tt> object with colors to subtract
+  <dd><tt><a href=Image.html>colortable</a></tt> object with colors to subtract
 </dl></blockquote>
 <h4>RETURNS</h4>
 
@@ -164,11 +172,11 @@ object <b>add</b>(int&nbsp;r, int&nbsp;g, int&nbsp;b, &nbsp;array(int)&nbsp;from
 
 
 <blockquote>
-<tt><a href=Image.colortable.html#create>create</a></tt> initiates a colortable object. 
+<tt><a href=Image.html>create</a></tt> initiates a colortable object. 
      Default is that no colors are in the colortable. 
 
-<p>     <tt><a href=Image.colortable.html#create>create</a></tt> can also take the same arguments
-     as <tt><a href=Image.colortable.html#add>add</a></tt>, thus adding colors to the colortable.
+<p>     <tt><a href=Image.html>create</a></tt> can also take the same arguments
+     as <tt><a href=Image.html>add</a></tt>, thus adding colors to the colortable.
 
 <p>     The colortable is mostly a list of colors,
      or more advanced, colors and weight.
@@ -304,12 +312,20 @@ Set the colortable to use the cubicles algorithm to lookup
      repeatedly, since the calculation takes much
      more time then usage.
 
-<p>     In some cases, the <tt><a href=Image.colortable.html#full>full</a></tt> method is faster.
+<p>     recommended values:
+
+<p>     <pre>   
+     image size  setup
+     100�100     cubicles(4,5,4) (default)
+     1000�1000   cubicles(12,12,12) (factor 2 faster than default)
+     </pre>  
+
+<p>     In some cases, the <tt><a href=Image.html>full</a></tt> method is faster.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_17.gif width=67 height=67></td>
-     <td><img src=illustration_18.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_3.gif><img border=0 src=illustration_3.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_23.gif><img border=0 src=illustration_23.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>default cubicles,<br>16 colors</td>
@@ -368,8 +384,8 @@ Set dithering method to floyd_steinberg.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_20.gif width=67 height=67></td>
-     <td><img src=illustration_21.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_25.gif><img border=0 src=illustration_25.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_26.gif><img border=0 src=illustration_26.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>floyd_steinberg to a 4�4�4 colorcube</td>
@@ -434,8 +450,8 @@ Not applicable to colorcube types of colortable.
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.colortable.html#cubicles>cubicles</a></tt>,
-     <tt><a href=Image.colortable.html#map>map</a></tt>
+<blockquote>     <tt><a href=Image.html>cubicles</a></tt>,
+     <tt><a href=Image.html>map</a></tt>
 </blockquote>
 
 <hr>
@@ -458,12 +474,90 @@ Set no dithering (default).
 the called object
 </blockquote>
 
+<hr>
+<a name=ordered> </a>
+<h4>SYNOPSIS</h4>
+<blockquote>
+<tt>object <b>ordered</b>()<br>
+object <b>ordered</b>(int&nbsp;r, int&nbsp;g, int&nbsp;b)<br>
+object <b>ordered</b>(int&nbsp;r, int&nbsp;g, int&nbsp;b, int&nbsp;xsize, int&nbsp;ysize)<br>
+object <b>ordered</b>(int&nbsp;r, int&nbsp;g, int&nbsp;b, int&nbsp;xsize, int&nbsp;ysize, int&nbsp;x, int&nbsp;y)<br>
+object <b>ordered</b>(int&nbsp;r, int&nbsp;g, int&nbsp;b, int&nbsp;xsize, int&nbsp;ysize, int&nbsp;rx, int&nbsp;ry, int&nbsp;gx, int&nbsp;gy, int&nbsp;bx, int&nbsp;by)</tt>
+</blockquote>
+
+<h4>DESCRIPTION</h4>
+
+
+<blockquote>
+Set ordered dithering, which gives a position-dependent error added
+     to the pixel values. 
+
+<p>     <table><tr valign=center>
+     <td><img src=lena.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_28.gif><img border=0 src=illustration_28.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_29.gif><img border=0 src=illustration_29.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_30.gif><img border=0 src=illustration_30.gif width=67 height=67></a></td>
+     </tr><tr valign=top>
+     <td>original</td>
+     <td colspan=2>mapped to <br><tt>Image.colortable(6,6,6)-></tt></td>
+     </tr><tr valign=top>
+     <td></td>
+     <td><tt>ordered<br> (42,42,42,2,2)</tt></td>
+     <td><tt>ordered()</tt></td>
+     <td><tt>ordered<br> (42,42,42, 8,8,<br> 0,0, 0,1, 1,0)</tt></td>
+     </tr><tr valign=top>
+     <td><a href=illustrations.html#illustration_31.gif><img border=0 src=illustration_31.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_32.gif><img border=0 src=illustration_32.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_33.gif><img border=0 src=illustration_33.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_34.gif><img border=0 src=illustration_34.gif width=67 height=67></a></td>
+     </tr></table>
+</blockquote>
+<h4>ARGUMENTS</h4>
+<blockquote><dl>
+<dt><tt>int r</tt>
+<dt><tt>int g</tt>
+<dt><tt>int b</tt>
+  <dd>The maximum error. Default is 32, or colorcube steps (256/size).
+<dt><tt>int xsize</tt>
+<dt><tt>int ysize</tt>
+  <dd>Size of error matrix. Default is 8�8.
+     Only values which factors to multiples of 2 and 3 are
+     possible to choose (2,3,4,6,8,12,...).
+<dt><tt>int x</tt>
+<dt><tt>int y</tt>
+<dt><tt>int rx</tt>
+<dt><tt>int ry</tt>
+<dt><tt>int gx</tt>
+<dt><tt>int gy</tt>
+<dt><tt>int bx</tt>
+<dt><tt>int by</tt>
+  <dd>Offset for the error matrix. <tt>x</tt> and <tt>y</tt> is for
+     both red, green and blue values, the other is individual.
+</dl></blockquote>
+<h4>RETURNS</h4>
+
+
+<blockquote>
+the called object
+</blockquote>
+
+
+<h4>SEE ALSO</h4>
+<blockquote>     <tt><a href=Image.html>randomcube</a></tt>,
+     <tt><a href=Image.html>nodither</a></tt>,
+     <tt><a href=Image.html>floyd_steinberg</a></tt>,
+     <tt><a href=Image.html>create</a></tt>
+</blockquote>
+
 <hr>
 <a name=randomcube> </a>
+<a name=randomgrey> </a>
 <h4>SYNOPSIS</h4>
 <blockquote>
 <tt>object <b>randomcube</b>()<br>
-object <b>randomcube</b>(int&nbsp;r, int&nbsp;g, int&nbsp;b)</tt>
+object <b>randomcube</b>(int&nbsp;r, int&nbsp;g, int&nbsp;b)<br>
+object <b>randomgrey</b>()<br>
+object <b>randomgrey</b>(int&nbsp;err)</tt>
 </blockquote>
 
 <h4>DESCRIPTION</h4>
@@ -474,12 +568,24 @@ Set random cube dithering.
      Color choosen is the closest one to color in picture
      plus (flat) random error; <tt>color�random(error)</tt>.
 
+<p>     The randomgrey method uses the same random error on red, green
+     and blue and the randomcube method has three random errors.
+
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_23.gif width=67 height=67></td>
-     </tr><tr valign=center>
+     <td><a href=illustrations.html#illustration_36.gif><img border=0 src=illustration_36.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_37.gif><img border=0 src=illustration_37.gif width=67 height=67></a></td>
+     </tr><tr valign=top>
      <td>original</td>
-     <td>mapped to <tt>Image.colortable(4,4,4)-><wbr>randomcube();</td>
+     <td colspan=2>mapped to <br><tt>Image.colortable(4,4,4)-></tt></td>
+     </tr><tr valign=top>
+     <td></td>
+     <td>randomcube()</td>
+     <td>randomgrey()</td>
+     </tr><tr valign=top>
+     <td><a href=illustrations.html#illustration_31.gif><img border=0 src=illustration_31.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_39.gif><img border=0 src=illustration_39.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_40.gif><img border=0 src=illustration_40.gif width=67 height=67></a></td>
      </tr></table>
 </blockquote>
 <h4>ARGUMENTS</h4>
@@ -487,6 +593,7 @@ Set random cube dithering.
 <dt><tt>int r</tt>
 <dt><tt>int g</tt>
 <dt><tt>int b</tt>
+<dt><tt>int err</tt>
   <dd>The maximum error. Default is 32, or colorcube step.
 </dl></blockquote>
 <h4>RETURNS</h4>
@@ -497,10 +604,19 @@ the called object
 </blockquote>
 
 
+<h4>NOTE</h4>
+<blockquote>
+<tt><a href=Image.html>randomgrey</a></tt> method needs colorcube size to be the same on
+     red, green and blue sides to work properly. It uses the
+     red colorcube value as default.
+</blockquote>
+
+
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.colortable.html#nodither>nodither</a></tt>,
-     <tt><a href=Image.colortable.html#floyd_steinberg>floyd_steinberg</a></tt>,
-     <tt><a href=Image.colortable.html#create>create</a></tt>
+<blockquote>     <tt><a href=Image.html>ordered</a></tt>,
+     <tt><a href=Image.html>nodither</a></tt>,
+     <tt><a href=Image.html>floyd_steinberg</a></tt>,
+     <tt><a href=Image.html>create</a></tt>
 </blockquote>
 
 <hr>
@@ -516,7 +632,7 @@ the called object
 <blockquote>
 reduces the number of colors
 
-<p>     All needed (see <tt><a href=Image.colortable.html#create>create</a></tt>) colors are kept.
+<p>     All needed (see <tt><a href=Image.html>create</a></tt>) colors are kept.
 </blockquote>
 <h4>ARGUMENTS</h4>
 <blockquote><dl>
@@ -546,7 +662,7 @@ Colortable tuning option, this sets the color space
      in the colorspace and comparing grey levels.
 
 <p>     Default factors are 2, 3 and 1; blue is much 
-     darker than green. Compare with <tt><a href=Image.image.html#grey>Image.image::grey</a></tt>().
+     darker than green. Compare with <tt><a href=Image.html>Image.image::grey</a></tt>().
 </blockquote>
 <h4>RETURNS</h4>
 
diff --git a/src/modules/Image/doc/Image.font.html b/src/modules/Image/doc/Image.font.html
index 18e05c7c13f18659527c48df7e53539060b7a5ce..b278b53b74e704b74d337d448eb09085319fb422 100644
--- a/src/modules/Image/doc/Image.font.html
+++ b/src/modules/Image/doc/Image.font.html
@@ -9,13 +9,13 @@ Short technical documentation on a font file:
      capabilities of the <tt><a href=Image.html>Image</a></tt> module.
 
 <p>     For simple usage, see
-     <tt><a href=Image.font.html#write>write</a></tt> and <tt><a href=Image.font.html#load>load</a></tt>.
+     <tt><a href=Image.html>write</a></tt> and <tt><a href=Image.html>load</a></tt>.
 
-<p>     other methods: <tt><a href=Image.font.html#baseline>baseline</a></tt>,
-     <tt><a href=Image.font.html#height>height</a></tt>,
-     <tt><a href=Image.font.html#set_xspacing_scale>set_xspacing_scale</a></tt>,
-     <tt><a href=Image.font.html#set_yspacing_scale>set_yspacing_scale</a></tt>,
-     <tt><a href=Image.font.html#text_extents>text_extents</a></tt>
+<p>     other methods: <tt><a href=Image.html>baseline</a></tt>,
+     <tt><a href=Image.html>height</a></tt>,
+     <tt><a href=Image.html>set_xspacing_scale</a></tt>,
+     <tt><a href=Image.html>set_yspacing_scale</a></tt>,
+     <tt><a href=Image.html>text_extents</a></tt>
      
      <pre>
             struct file_head 
@@ -39,7 +39,7 @@ Short technical documentation on a font file:
 
 <h4>SEE ALSO</h4>
 <blockquote>     <tt><a href=Image.html>Image</a></tt>,
-     <tt><a href=Image.image.html>Image.image</a></tt>
+     <tt><a href=Image.html>Image.image</a></tt>
 </blockquote>
 
 <hr>
@@ -58,8 +58,8 @@ font baseline (pixels from top)
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.font.html#height>height</a></tt>,
-     <tt><a href=Image.font.html#text_extents>text_extents</a></tt>
+<blockquote>     <tt><a href=Image.html>height</a></tt>,
+     <tt><a href=Image.html>text_extents</a></tt>
 </blockquote>
 
 <hr>
@@ -76,7 +76,7 @@ array(int) <b>text_extents</b>(string&nbsp;text, ...)</tt>
 
 <blockquote>
 Calculate extents of a text-image,
-     that would be created by calling <tt><a href=Image.font.html#write>write</a></tt>
+     that would be created by calling <tt><a href=Image.html>write</a></tt>
      with the same arguments.
 </blockquote>
 <h4>ARGUMENTS</h4>
@@ -93,9 +93,9 @@ an array of width and height
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.font.html#write>write</a></tt>,
-     <tt><a href=Image.font.html#height>height</a></tt>,
-     <tt><a href=Image.font.html#baseline>baseline</a></tt>
+<blockquote>     <tt><a href=Image.html>write</a></tt>,
+     <tt><a href=Image.html>height</a></tt>,
+     <tt><a href=Image.html>baseline</a></tt>
 </blockquote>
 
 <hr>
@@ -125,7 +125,7 @@ zero upon failure, font object upon success
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.font.html#write>write</a></tt>
+<blockquote>     <tt><a href=Image.html>write</a></tt>
 </blockquote>
 
 <hr>
@@ -179,8 +179,8 @@ an <ref>Image::image</ref> object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.font.html#text_extents>text_extents</a></tt>,
-     <tt><a href=Image.font.html#load>load</a></tt>,
-     <tt><a href=Image.image.html#paste_mask>image::paste_mask</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha_color>image::paste_alpha_color</a></tt>
+<blockquote>     <tt><a href=Image.html>text_extents</a></tt>,
+     <tt><a href=Image.html>load</a></tt>,
+     <tt><a href=Image.html>image::paste_mask</a></tt>,
+     <tt><a href=Image.html>image::paste_alpha_color</a></tt>
 </blockquote>
diff --git a/src/modules/Image/doc/Image.html b/src/modules/Image/doc/Image.html
index 86edaf9fa63c8bd4e9ee4ca4a83370fa42a2014a..bbbf85d53d069302b48a157ef6ac94cac61d60df 100644
--- a/src/modules/Image/doc/Image.html
+++ b/src/modules/Image/doc/Image.html
@@ -8,19 +8,19 @@ This module adds image-drawing and -manipulating
 
 <p>     <table border=0>
      <tr>
-     <td align=left valign=top><tt><a href=Image.image.html>Image.image</a></tt></td>
+     <td align=left valign=top><tt><a href=Image.html>Image.image</a></tt></td>
      <td align=left valign=top>Basic image manipulation</td>
      </tr>
      <tr>
-     <td align=left valign=top><tt><a href=Image.font.html>Image.font</a></tt></td>
+     <td align=left valign=top><tt><a href=Image.html>Image.font</a></tt></td>
      <td align=left valign=top>Creating images from text</td>
      </tr>
      <tr>
-     <td align=left valign=top><tt><a href=Image.colortable.html>Image.colortable</a></tt></td>
+     <td align=left valign=top><tt><a href=Image.html>Image.colortable</a></tt></td>
      <td align=left valign=top>Color reduction, quantisation and dither</td>
      </tr>
      <tr>
-     <td align=left valign=top><tt><a href=Image.GIF.html>Image.GIF</a></tt></td>
+     <td align=left valign=top><tt><a href=Image.html>Image.GIF</a></tt></td>
      <td align=left valign=top>GIF encoding/decoding capabilities</td>
      </tr>
      </table>
@@ -30,25 +30,26 @@ This module adds image-drawing and -manipulating
 <h4>NOTE</h4>
 <blockquote>
 <font size=-1><pre>file versions:
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
-     $Id: Image.html,v 1.10 1997/10/27 22:41:33 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
+     $Id: Image.html,v 1.11 1997/11/02 03:44:32 mirar Exp $
      </pre>
 </blockquote>
diff --git a/src/modules/Image/doc/Image.image.html b/src/modules/Image/doc/Image.image.html
index 476b523fd8245aaac8bfc4466f70b9a0647d2f3d..edf9179b17979355e423fc595fbce9ff8266780d 100644
--- a/src/modules/Image/doc/Image.image.html
+++ b/src/modules/Image/doc/Image.image.html
@@ -6,94 +6,94 @@
 The main object of the <tt><a href=Image.html>Image</a></tt> module, this object
      is used as drawing area, mask or result of operations.
 
-<p>     init: <tt><a href=Image.image.html#clear>clear</a></tt>,
-     <tt><a href=Image.image.html#clone>clone</a></tt>,
-     <tt><a href=Image.image.html#create>create</a></tt>, 
-     <tt><a href=Image.image.html#xsize>xsize</a></tt>,
-     <tt><a href=Image.image.html#ysize>ysize</a></tt>
-
-<p>     plain drawing: <tt><a href=Image.image.html#box>box</a></tt>,
-     <tt><a href=Image.image.html#circle>circle</a></tt>,
-     <tt><a href=Image.image.html#getpixel>getpixel</a></tt>, 
-     <tt><a href=Image.image.html#line>line</a></tt>,
-     <tt><a href=Image.image.html#setcolor>setcolor</a></tt>,
-     <tt><a href=Image.image.html#setpixel>setpixel</a></tt>, 
-     <tt><a href=Image.image.html#treshold>treshold</a></tt>,
-     <tt><a href=Image.image.html#tuned_box>tuned_box</a></tt>,
-     <tt><a href=Image.image.html#polygone>polygone</a></tt>
-
-<p>     operators: <tt><a href=Image.image.html#%60%26>`&amp;</a></tt>,
-     <tt><a href=Image.image.html#%60*>`*</a></tt>,
-     <tt><a href=Image.image.html#%60+>`+</a></tt>,
-     <tt><a href=Image.image.html#%60->`-</a></tt>,
-     <tt><a href=Image.image.html#%60|>`|</a></tt>
-
-<p>     pasting images, layers: <tt><a href=Image.image.html#add_layers>add_layers</a></tt>, 
-     <tt><a href=Image.image.html#paste>paste</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha>paste_alpha</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha_color>paste_alpha_color</a></tt>,
-     <tt><a href=Image.image.html#paste_mask>paste_mask</a></tt>
-
-<p>     getting subimages, scaling, rotating: <tt><a href=Image.image.html#autocrop>autocrop</a></tt>, 
-     <tt><a href=Image.image.html#clone>clone</a></tt>,
-     <tt><a href=Image.image.html#copy>copy</a></tt>, 
-     <tt><a href=Image.image.html#dct>dct</a></tt>,
-     <tt><a href=Image.image.html#mirrorx>mirrorx</a></tt>, 
-     <tt><a href=Image.image.html#rotate>rotate</a></tt>,
-     <tt><a href=Image.image.html#rotate_expand>rotate_expand</a></tt>, 
-     <tt><a href=Image.image.html#rotate_ccw>rotate_ccw</a></tt>,
-     <tt><a href=Image.image.html#rotate_cw>rotate_cw</a></tt>,
-     <tt><a href=Image.image.html#scale>scale</a></tt>, 
-     <tt><a href=Image.image.html#skewx>skewx</a></tt>,
-     <tt><a href=Image.image.html#skewx_expand>skewx_expand</a></tt>,
-     <tt><a href=Image.image.html#skewy>skewy</a></tt>,
-     <tt><a href=Image.image.html#skewy_expand>skewy_expand</a></tt>
-
-<p>     calculation by pixels: <tt><a href=Image.image.html#apply_matrix>apply_matrix</a></tt>, 
-     <tt><a href=Image.image.html#change_color>change_color</a></tt>,
-     <tt><a href=Image.image.html#color>color</a></tt>,
-     <tt><a href=Image.image.html#distancesq>distancesq</a></tt>, 
-     <tt><a href=Image.image.html#grey>grey</a></tt>,
-     <tt><a href=Image.image.html#invert>invert</a></tt>, 
-     <tt><a href=Image.image.html#map_closest>map_closest</a></tt>,
-     <tt><a href=Image.image.html#map_fast>map_fast</a></tt>, 
-     <tt><a href=Image.image.html#select_colors>select_colors</a></tt>,
-     <tt><a href=Image.image.html#modify_by_intensity>modify_by_intensity</a></tt>,
-     <tt><a href=Image.image.html#select_from>select_from</a></tt>, 
-     <tt><a href=Image.image.html#rgb_to_hsv>rgb_to_hsv</a></tt>,
-     <tt><a href=Image.image.html#hsv_to_rgb>hsv_to_rgb</a></tt>
-
-<p>     converting to other datatypes: <tt><a href=Image.image.html#cast>cast</a></tt>,
-     <tt><a href=Image.image.html#fromgif>fromgif</a></tt>, 
-     <tt><a href=Image.image.html#frompnm>frompnm</a></tt>/<tt><a href=Image.image.html#fromppm>fromppm</a></tt>, 
-     <tt><a href=Image.image.html#gif_add>gif_add</a></tt>,
-     <tt><a href=Image.image.html#gif_add_fs>gif_add_fs</a></tt>,
-     <tt><a href=Image.image.html#gif_add_fs_nomap>gif_add_fs_nomap</a></tt>,
-     <tt><a href=Image.image.html#gif_add_nomap>gif_add_nomap</a></tt>,
-     <tt><a href=Image.image.html#gif_begin>gif_begin</a></tt>,
-     <tt><a href=Image.image.html#gif_end>gif_end</a></tt>,
-     <tt><a href=Image.image.html#gif_netscape_loop>gif_netscape_loop</a></tt>,
-     <tt><a href=Image.image.html#gif_transparency>gif_transparency</a></tt>,
-     <tt><a href=Image.image.html#to8bit>to8bit</a></tt>,
-     <tt><a href=Image.image.html#to8bit_closest>to8bit_closest</a></tt>, 
-     <tt><a href=Image.image.html#to8bit_fs>to8bit_fs</a></tt>,
-     <tt><a href=Image.image.html#to8bit_rgbcube>to8bit_rgbcube</a></tt>, 
-     <tt><a href=Image.image.html#to8bit_rgbcube_rdither>to8bit_rgbcube_rdither</a></tt>,
-     <tt><a href=Image.image.html#tobitmap>tobitmap</a></tt>, 
-     <tt><a href=Image.image.html#togif>togif</a></tt>,
-     <tt><a href=Image.image.html#togif_fs>togif_fs</a></tt>, 
-     <tt><a href=Image.image.html#toppm>toppm</a></tt>,
-     <tt><a href=Image.image.html#tozbgr>tozbgr</a></tt>
+<p>     init: <tt><a href=Image.html>clear</a></tt>,
+     <tt><a href=Image.html>clone</a></tt>,
+     <tt><a href=Image.html>create</a></tt>, 
+     <tt><a href=Image.html>xsize</a></tt>,
+     <tt><a href=Image.html>ysize</a></tt>
+
+<p>     plain drawing: <tt><a href=Image.html>box</a></tt>,
+     <tt><a href=Image.html>circle</a></tt>,
+     <tt><a href=Image.html>getpixel</a></tt>, 
+     <tt><a href=Image.html>line</a></tt>,
+     <tt><a href=Image.html>setcolor</a></tt>,
+     <tt><a href=Image.html>setpixel</a></tt>, 
+     <tt><a href=Image.html>treshold</a></tt>,
+     <tt><a href=Image.html>tuned_box</a></tt>,
+     <tt><a href=Image.html>polygone</a></tt>
+
+<p>     operators: <tt><a href=Image.html>`&amp;</a></tt>,
+     <tt><a href=Image.html>`*</a></tt>,
+     <tt><a href=Image.html>`+</a></tt>,
+     <tt><a href=Image.html>`-</a></tt>,
+     <tt><a href=Image.html>`|</a></tt>
+
+<p>     pasting images, layers: <tt><a href=Image.html>add_layers</a></tt>, 
+     <tt><a href=Image.html>paste</a></tt>,
+     <tt><a href=Image.html>paste_alpha</a></tt>,
+     <tt><a href=Image.html>paste_alpha_color</a></tt>,
+     <tt><a href=Image.html>paste_mask</a></tt>
+
+<p>     getting subimages, scaling, rotating: <tt><a href=Image.html>autocrop</a></tt>, 
+     <tt><a href=Image.html>clone</a></tt>,
+     <tt><a href=Image.html>copy</a></tt>, 
+     <tt><a href=Image.html>dct</a></tt>,
+     <tt><a href=Image.html>mirrorx</a></tt>, 
+     <tt><a href=Image.html>rotate</a></tt>,
+     <tt><a href=Image.html>rotate_expand</a></tt>, 
+     <tt><a href=Image.html>rotate_ccw</a></tt>,
+     <tt><a href=Image.html>rotate_cw</a></tt>,
+     <tt><a href=Image.html>scale</a></tt>, 
+     <tt><a href=Image.html>skewx</a></tt>,
+     <tt><a href=Image.html>skewx_expand</a></tt>,
+     <tt><a href=Image.html>skewy</a></tt>,
+     <tt><a href=Image.html>skewy_expand</a></tt>
+
+<p>     calculation by pixels: <tt><a href=Image.html>apply_matrix</a></tt>, 
+     <tt><a href=Image.html>change_color</a></tt>,
+     <tt><a href=Image.html>color</a></tt>,
+     <tt><a href=Image.html>distancesq</a></tt>, 
+     <tt><a href=Image.html>grey</a></tt>,
+     <tt><a href=Image.html>invert</a></tt>, 
+     <tt><a href=Image.html>map_closest</a></tt>,
+     <tt><a href=Image.html>map_fast</a></tt>, 
+     <tt><a href=Image.html>select_colors</a></tt>,
+     <tt><a href=Image.html>modify_by_intensity</a></tt>,
+     <tt><a href=Image.html>select_from</a></tt>, 
+     <tt><a href=Image.html>rgb_to_hsv</a></tt>,
+     <tt><a href=Image.html>hsv_to_rgb</a></tt>
+
+<p>     converting to other datatypes: <tt><a href=Image.html>cast</a></tt>,
+     <tt><a href=Image.html>fromgif</a></tt>, 
+     <tt><a href=Image.html>frompnm</a></tt>/<tt><a href=Image.html>fromppm</a></tt>, 
+     <tt><a href=Image.html>gif_add</a></tt>,
+     <tt><a href=Image.html>gif_add_fs</a></tt>,
+     <tt><a href=Image.html>gif_add_fs_nomap</a></tt>,
+     <tt><a href=Image.html>gif_add_nomap</a></tt>,
+     <tt><a href=Image.html>gif_begin</a></tt>,
+     <tt><a href=Image.html>gif_end</a></tt>,
+     <tt><a href=Image.html>gif_netscape_loop</a></tt>,
+     <tt><a href=Image.html>gif_transparency</a></tt>,
+     <tt><a href=Image.html>to8bit</a></tt>,
+     <tt><a href=Image.html>to8bit_closest</a></tt>, 
+     <tt><a href=Image.html>to8bit_fs</a></tt>,
+     <tt><a href=Image.html>to8bit_rgbcube</a></tt>, 
+     <tt><a href=Image.html>to8bit_rgbcube_rdither</a></tt>,
+     <tt><a href=Image.html>tobitmap</a></tt>, 
+     <tt><a href=Image.html>togif</a></tt>,
+     <tt><a href=Image.html>togif_fs</a></tt>, 
+     <tt><a href=Image.html>toppm</a></tt>,
+     <tt><a href=Image.html>tozbgr</a></tt>
 
 <p>     special pattern drawing:
-     <tt><a href=Image.image.html#noise>noise</a></tt>,
-     <tt><a href=Image.image.html#turbulence>turbulence</a></tt>
+     <tt><a href=Image.html>noise</a></tt>,
+     <tt><a href=Image.html>turbulence</a></tt>
 </blockquote>
 
 
 <h4>SEE ALSO</h4>
 <blockquote>     <tt><a href=Image.html>Image</a></tt>,
-     <tt><a href=Image.font.html>Image.font</a></tt>
+     <tt><a href=Image.html>Image.font</a></tt>
 </blockquote>
 
 <hr>
@@ -131,11 +131,11 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#%60->`-</a></tt>,
-     <tt><a href=Image.image.html#%60+>`+</a></tt>,
-     <tt><a href=Image.image.html#%60|>`|</a></tt>,
-     <tt><a href=Image.image.html#%60*>`*</a></tt>,
-     <tt><a href=Image.image.html#add_layers>add_layers</a></tt>
+<blockquote>     <tt><a href=Image.html>`-</a></tt>,
+     <tt><a href=Image.html>`+</a></tt>,
+     <tt><a href=Image.html>`|</a></tt>,
+     <tt><a href=Image.html>`*</a></tt>,
+     <tt><a href=Image.html>add_layers</a></tt>
 </blockquote>
 
 <hr>
@@ -178,11 +178,11 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#%60->`-</a></tt>,
-     <tt><a href=Image.image.html#%60+>`+</a></tt>,
-     <tt><a href=Image.image.html#%60|>`|</a></tt>,
-     <tt><a href=Image.image.html#%60%26>`&</a></tt>,
-     <tt><a href=Image.image.html#add_layers>add_layers</a></tt>
+<blockquote>     <tt><a href=Image.html>`-</a></tt>,
+     <tt><a href=Image.html>`+</a></tt>,
+     <tt><a href=Image.html>`|</a></tt>,
+     <tt><a href=Image.html>`&</a></tt>,
+     <tt><a href=Image.html>add_layers</a></tt>
 </blockquote>
 
 <hr>
@@ -219,11 +219,11 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#%60->`-</a></tt>,
-     <tt><a href=Image.image.html#%60|>`|</a></tt>,
-     <tt><a href=Image.image.html#%60%26>`&</a></tt>,
-     <tt><a href=Image.image.html#%60*>`*</a></tt>,
-     <tt><a href=Image.image.html#add_layers>add_layers</a></tt>
+<blockquote>     <tt><a href=Image.html>`-</a></tt>,
+     <tt><a href=Image.html>`|</a></tt>,
+     <tt><a href=Image.html>`&</a></tt>,
+     <tt><a href=Image.html>`*</a></tt>,
+     <tt><a href=Image.html>add_layers</a></tt>
 </blockquote>
 
 <hr>
@@ -261,11 +261,11 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#%60+>`+</a></tt>,
-     <tt><a href=Image.image.html#%60|>`|</a></tt>,
-     <tt><a href=Image.image.html#%60%26>`&</a></tt>,
-     <tt><a href=Image.image.html#%60*>`*</a></tt>,
-     <tt><a href=Image.image.html#add_layers>add_layers</a></tt>
+<blockquote>     <tt><a href=Image.html>`+</a></tt>,
+     <tt><a href=Image.html>`|</a></tt>,
+     <tt><a href=Image.html>`&</a></tt>,
+     <tt><a href=Image.html>`*</a></tt>,
+     <tt><a href=Image.html>add_layers</a></tt>
 </blockquote>
 
 <hr>
@@ -303,11 +303,11 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#%60->`-</a></tt>,
-     <tt><a href=Image.image.html#%60+>`+</a></tt>,
-     <tt><a href=Image.image.html#%60%26>`&</a></tt>,
-     <tt><a href=Image.image.html#%60*>`*</a></tt>,
-     <tt><a href=Image.image.html#add_layers>add_layers</a></tt>
+<blockquote>     <tt><a href=Image.html>`-</a></tt>,
+     <tt><a href=Image.html>`+</a></tt>,
+     <tt><a href=Image.html>`&</a></tt>,
+     <tt><a href=Image.html>`*</a></tt>,
+     <tt><a href=Image.html>add_layers</a></tt>
 </blockquote>
 
 <hr>
@@ -372,14 +372,14 @@ a new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#paste_mask>paste_mask</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha>paste_alpha</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha_color>paste_alpha_color</a></tt>,
-     <tt><a href=Image.image.html#%60|>`|</a></tt>,
-     <tt><a href=Image.image.html#%60%26>`&</a></tt>,
-     <tt><a href=Image.image.html#%60*>`*</a></tt>,
-     <tt><a href=Image.image.html#%60+>`+</a></tt>,
-     <tt><a href=Image.image.html#%60->`-</a></tt>
+<blockquote>     <tt><a href=Image.html>paste_mask</a></tt>,
+     <tt><a href=Image.html>paste_alpha</a></tt>,
+     <tt><a href=Image.html>paste_alpha_color</a></tt>,
+     <tt><a href=Image.html>`|</a></tt>,
+     <tt><a href=Image.html>`&</a></tt>,
+     <tt><a href=Image.html>`*</a></tt>,
+     <tt><a href=Image.html>`+</a></tt>,
+     <tt><a href=Image.html>`-</a></tt>
 </blockquote>
 
 <hr>
@@ -414,7 +414,7 @@ Applies a pixel-transform matrix, or filter, to the image.
        ({1,2,1})})
      </pre>
      </td><td>
-     <img src=illustration_24.gif width=67 height=67>
+     <a href=illustrations.html#illustration_41.gif><img border=0 src=illustration_41.gif width=67 height=67></a>
      </td><td>
      <img src=lena.gif width=67 height=67>
      </td>
@@ -428,7 +428,7 @@ Applies a pixel-transform matrix, or filter, to the image.
        ({-1,-1,-1})})
      </pre>
      </td><td>
-     <img src=illustration_26.gif width=67 height=67>
+     <a href=illustrations.html#illustration_43.gif><img border=0 src=illustration_43.gif width=67 height=67></a>
      </td>
 
 <p>     <tr><td>
@@ -439,7 +439,7 @@ Applies a pixel-transform matrix, or filter, to the image.
        ({1, 1,1})})
      </pre>
      </td><td>
-     <img src=illustration_27.gif width=67 height=67>
+     <a href=illustrations.html#illustration_44.gif><img border=0 src=illustration_44.gif width=67 height=67></a>
      </td>
 
 <p>     <tr><td>
@@ -450,20 +450,20 @@ Applies a pixel-transform matrix, or filter, to the image.
        ({0, 0,0})})
      </pre>
      </td><td>
-     <img src=illustration_28.gif width=67 height=67>
+     <a href=illustrations.html#illustration_45.gif><img border=0 src=illustration_45.gif width=67 height=67></a>
      </td>
 
 <p>     <tr><td rowspan=2>
-     emboss (might prefer to begin with a <tt><a href=Image.image.html#grey>grey</a></tt> image):
+     emboss (might prefer to begin with a <tt><a href=Image.html>grey</a></tt> image):
      <pre>
      ({({2, 1, 0}),
        ({1, 0,-1}),
        ({0,-1,-2})}), 128,128,128, 3
      </pre>
      </td><td>
-     <img src=illustration_29.gif width=67 height=67>
+     <a href=illustrations.html#illustration_46.gif><img border=0 src=illustration_46.gif width=67 height=67></a>
      </td><td>
-     <img src=illustration_30.gif width=67 height=67>
+     <a href=illustrations.html#illustration_47.gif><img border=0 src=illustration_47.gif width=67 height=67></a>
      </td>
      <tr><td></td><td>greyed</td></table>
 
@@ -536,7 +536,7 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#copy>copy</a></tt>
+<blockquote>     <tt><a href=Image.html>copy</a></tt>
 </blockquote>
 
 <hr>
@@ -612,12 +612,12 @@ always casts to string...
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#to8bit_rgbcube>to8bit_rgbcube</a></tt>,
-     <tt><a href=Image.image.html#tozbgr>tozbgr</a></tt>,
-     <tt><a href=Image.image.html#map_fast>map_fast</a></tt>,
-     <tt><a href=Image.image.html#map_closest>map_closest</a></tt>,
-     <tt><a href=Image.image.html#select_colors>select_colors</a></tt>,
-     <tt><a href=Image.image.html#tobitmap>tobitmap</a></tt>
+<blockquote>     <tt><a href=Image.html>to8bit_rgbcube</a></tt>,
+     <tt><a href=Image.html>tozbgr</a></tt>,
+     <tt><a href=Image.html>map_fast</a></tt>,
+     <tt><a href=Image.html>map_closest</a></tt>,
+     <tt><a href=Image.html>select_colors</a></tt>,
+     <tt><a href=Image.html>tobitmap</a></tt>
 </blockquote>
 
 <hr>
@@ -633,8 +633,8 @@ object <b>change_color</b>(int&nbsp;fromr, int&nbsp;fromg, int&nbsp;fromb, &nbsp
 
 <blockquote>
 Changes one color (exakt match) to another.
-     If non-exakt-match is preferred, check <tt><a href=Image.image.html#distancesq>distancesq</a></tt>
-     and <tt><a href=Image.image.html#paste_alpha_color>paste_alpha_color</a></tt>.
+     If non-exakt-match is preferred, check <tt><a href=Image.html>distancesq</a></tt>
+     and <tt><a href=Image.html>paste_alpha_color</a></tt>.
 </blockquote>
 <h4>ARGUMENTS</h4>
 <blockquote><dl>
@@ -718,8 +718,8 @@ gives a new, cleared image with the same size of drawing area
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#copy>copy</a></tt>,
-     <tt><a href=Image.image.html#clone>clone</a></tt>
+<blockquote>     <tt><a href=Image.html>copy</a></tt>,
+     <tt><a href=Image.html>clone</a></tt>
 </blockquote>
 
 <hr>
@@ -763,8 +763,8 @@ the new object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#copy>copy</a></tt>,
-     <tt><a href=Image.image.html#create>create</a></tt>
+<blockquote>     <tt><a href=Image.html>copy</a></tt>,
+     <tt><a href=Image.html>create</a></tt>
 </blockquote>
 
 <hr>
@@ -791,7 +791,7 @@ Colorize an image.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_32.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_49.gif><img border=0 src=illustration_49.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->color(128,128,255);</td>
@@ -815,9 +815,9 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#grey>grey</a></tt>,
-     <tt><a href=Image.image.html#%60*>`*</a></tt>,
-     <tt><a href=Image.image.html#modify_by_intensity>modify_by_intensity</a></tt>
+<blockquote>     <tt><a href=Image.html>grey</a></tt>,
+     <tt><a href=Image.html>`*</a></tt>,
+     <tt><a href=Image.html>modify_by_intensity</a></tt>
 </blockquote>
 
 <hr>
@@ -862,14 +862,14 @@ a new image object
 
 <h4>NOTE</h4>
 <blockquote>
-<tt><a href=Image.image.html#clone>clone</a></tt>(void) and <tt><a href=Image.image.html#copy>copy</a></tt>(void) does the same 
+<tt><a href=Image.html>clone</a></tt>(void) and <tt><a href=Image.html>copy</a></tt>(void) does the same 
      operation
 </blockquote>
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#clone>clone</a></tt>,
-     <tt><a href=Image.image.html#autocrop>autocrop</a></tt>
+<blockquote>     <tt><a href=Image.html>clone</a></tt>,
+     <tt><a href=Image.html>autocrop</a></tt>
 </blockquote>
 
 <hr>
@@ -912,9 +912,9 @@ SIGSEGS can be caused if the size is too big, due
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#copy>copy</a></tt>,
-     <tt><a href=Image.image.html#clone>clone</a></tt>,
-     <tt><a href=Image.image.html>Image.image</a></tt>
+<blockquote>     <tt><a href=Image.html>copy</a></tt>,
+     <tt><a href=Image.html>clone</a></tt>,
+     <tt><a href=Image.html>Image.image</a></tt>
 </blockquote>
 
 <hr>
@@ -993,7 +993,7 @@ Makes an grey-scale image, for alpha-channel use.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_34.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_51.gif><img border=0 src=illustration_51.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->distancesq(255,0,128);</td>
@@ -1015,7 +1015,7 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#select_from>select_from</a></tt>
+<blockquote>     <tt><a href=Image.html>select_from</a></tt>
 </blockquote>
 
 <hr>
@@ -1054,8 +1054,8 @@ yes, it does -- it may even do segment overrides...
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#togif>togif</a></tt>,
-     <tt><a href=Image.image.html#frompnm>frompnm</a></tt>
+<blockquote>     <tt><a href=Image.html>togif</a></tt>,
+     <tt><a href=Image.html>frompnm</a></tt>
 </blockquote>
 
 <hr>
@@ -1071,12 +1071,9 @@ object|string <b>fromppm</b>(string&nbsp;pnm)</tt>
 
 
 <blockquote>
-Reads a PNM (PBM, PGM or PPM in ascii or binary)
-     to the called image object.
-
-<p>     The method accepts P1 through P6 type of PNM data.
-
-<p>     "fromppm" is an alias for "frompnm".
+<b>compability method</b> - do not use in new programs.
+     
+     See <tt><a href=Image.PNM.html#decode>Image.PNM.decode</a></tt>().
 </blockquote>
 <h4>ARGUMENTS</h4>
 <blockquote><dl>
@@ -1090,12 +1087,6 @@ Reads a PNM (PBM, PGM or PPM in ascii or binary)
 the called object or a hint of what wronged.
 </blockquote>
 
-
-<h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#toppm>toppm</a></tt>,
-     <tt><a href=Image.image.html#fromgif>fromgif</a></tt>
-</blockquote>
-
 <hr>
 <a name=getpixel> </a>
 <h4>SYNOPSIS</h4>
@@ -1210,10 +1201,10 @@ I (Mirar) recommend reading about the GIF file format before
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#gif_add>gif_add</a></tt>,
-     <tt><a href=Image.image.html#gif_end>gif_end</a></tt>,
-     <tt><a href=Image.image.html#gif_netscape_loop>gif_netscape_loop</a></tt>,
-     <tt><a href=Image.image.html#togif */>togif */</a></tt>
+<blockquote>     <tt><a href=Image.html>gif_add</a></tt>,
+     <tt><a href=Image.html>gif_end</a></tt>,
+     <tt><a href=Image.html>gif_netscape_loop</a></tt>,
+     <tt><a href=Image.html>togif */</a></tt>
 </blockquote>
 
 <hr>
@@ -1248,10 +1239,10 @@ the GIF data
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#gif_add>gif_add</a></tt>,
-     <tt><a href=Image.image.html#gif_end>gif_end</a></tt>,
-     <tt><a href=Image.image.html#togif>togif</a></tt>,
-     <tt><a href=Image.image.html#gif_netscape_loop>gif_netscape_loop</a></tt>
+<blockquote>     <tt><a href=Image.html>gif_add</a></tt>,
+     <tt><a href=Image.html>gif_end</a></tt>,
+     <tt><a href=Image.html>togif</a></tt>,
+     <tt><a href=Image.html>gif_netscape_loop</a></tt>
 </blockquote>
 
 <hr>
@@ -1276,7 +1267,7 @@ the GIF data.
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#gif_begin>gif_begin</a></tt>
+<blockquote>     <tt><a href=Image.html>gif_begin</a></tt>
 </blockquote>
 
 <hr>
@@ -1301,9 +1292,9 @@ a gif chunk that defines that the GIF animation should loop
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#gif_add>gif_add</a></tt>,
-     <tt><a href=Image.image.html#gif_begin>gif_begin</a></tt>,
-     <tt><a href=Image.image.html#gif_end>gif_end</a></tt>
+<blockquote>     <tt><a href=Image.html>gif_add</a></tt>,
+     <tt><a href=Image.html>gif_begin</a></tt>,
+     <tt><a href=Image.html>gif_end</a></tt>
 </blockquote>
 
 <hr>
@@ -1334,9 +1325,9 @@ Yes - i know this function is too hard to use. :/
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#gif_add>gif_add</a></tt>,
-     <tt><a href=Image.image.html#gif_begin>gif_begin</a></tt>,
-     <tt><a href=Image.image.html#gif_end>gif_end</a></tt>
+<blockquote>     <tt><a href=Image.html>gif_add</a></tt>,
+     <tt><a href=Image.html>gif_begin</a></tt>,
+     <tt><a href=Image.html>gif_end</a></tt>
 </blockquote>
 
 <hr>
@@ -1356,8 +1347,8 @@ Makes a grey-scale image (with weighted values).
 <p>
      <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_36.gif width=67 height=67></td>
-     <td><img src=illustration_37.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_53.gif><img border=0 src=illustration_53.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_54.gif><img border=0 src=illustration_54.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->grey();</td>
@@ -1381,9 +1372,9 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#color>color</a></tt>,
-     <tt><a href=Image.image.html#%60*>`*</a></tt>,
-     <tt><a href=Image.image.html#modify_by_intensity>modify_by_intensity</a></tt>
+<blockquote>     <tt><a href=Image.html>color</a></tt>,
+     <tt><a href=Image.html>`*</a></tt>,
+     <tt><a href=Image.html>modify_by_intensity</a></tt>
 </blockquote>
 
 <hr>
@@ -1408,16 +1399,16 @@ Converts RGB data to HSV data, or the other way around.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_39.gif width=67 height=67></td>
-     <td><img src=illustration_40.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_56.gif><img border=0 src=illustration_56.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_57.gif><img border=0 src=illustration_57.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->hsv_to_rgb();</td>
      <td>->rgb_to_hsv();</td>
      </tr><tr valign=center>
-     <td><img src=illustration_41.gif width=67 height=67></td>
-     <td><img src=illustration_42.gif width=67 height=67></td>
-     <td><img src=illustration_43.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_58.gif><img border=0 src=illustration_58.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_59.gif><img border=0 src=illustration_59.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_60.gif><img border=0 src=illustration_60.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>tuned box (below)</td>
      <td>the rainbow (below)</td>
@@ -1471,8 +1462,8 @@ Invert an image. Each pixel value gets to be 255-x, where x
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_45.gif width=67 height=67></td>
-     <td><img src=illustration_46.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_62.gif><img border=0 src=illustration_62.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_63.gif><img border=0 src=illustration_63.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->invert();</td>
@@ -1541,7 +1532,7 @@ Maps all pixel colors to the colors given.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_48.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_65.gif><img border=0 src=illustration_65.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->map_closest(({({255,0,0}),({255,255,255}),({0,0,0})}));</td>
@@ -1562,15 +1553,15 @@ the new image object
 
 <h4>NOTE</h4>
 <blockquote>
-this function may change slightly when <tt><a href=Image.Image.html#colortable>Image::colortable</a></tt> 
+this function may change slightly when <tt><a href=Image.html>Image::colortable</a></tt> 
      is implemented (pike 0.6, probably)
 </blockquote>
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#map_fast>map_fast</a></tt>,
-     <tt><a href=Image.image.html#select_colors>select_colors</a></tt>,
-     <tt><a href=Image.image.html#map_fs>map_fs</a></tt>
+<blockquote>     <tt><a href=Image.html>map_fast</a></tt>,
+     <tt><a href=Image.html>select_colors</a></tt>,
+     <tt><a href=Image.html>map_fs</a></tt>
 </blockquote>
 
 <hr>
@@ -1607,14 +1598,14 @@ the new image object
 
 <h4>NOTE</h4>
 <blockquote>
-this function may change slightly when <tt><a href=Image.Image.html#colortable>Image::colortable</a></tt> 
+this function may change slightly when <tt><a href=Image.html>Image::colortable</a></tt> 
      is implemented (pike 0.6, probably)
 </blockquote>
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#map_fast>map_fast</a></tt>,
-     <tt><a href=Image.image.html#select_colors>select_colors</a></tt>
+<blockquote>     <tt><a href=Image.html>map_fast</a></tt>,
+     <tt><a href=Image.html>select_colors</a></tt>
 </blockquote>
 
 <hr>
@@ -1639,7 +1630,7 @@ Maps all pixel colors to the colors given.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_50.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_67.gif><img border=0 src=illustration_67.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->map_fs(({({255,0,0}),({255,255,255}),({0,0,0})}));</td>
@@ -1660,15 +1651,15 @@ the new image object
 
 <h4>NOTE</h4>
 <blockquote>
-this function may change slightly when <tt><a href=Image.Image.html#colortable>Image::colortable</a></tt> 
+this function may change slightly when <tt><a href=Image.html>Image::colortable</a></tt> 
      is implemented (pike 0.6, probably)
 </blockquote>
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#map_fast>map_fast</a></tt>,
-     <tt><a href=Image.image.html#select_colors>select_colors</a></tt>,
-     <tt><a href=Image.image.html#map_closest>map_closest</a></tt>
+<blockquote>     <tt><a href=Image.html>map_fast</a></tt>,
+     <tt><a href=Image.html>select_colors</a></tt>,
+     <tt><a href=Image.html>map_closest</a></tt>
 </blockquote>
 
 <hr>
@@ -1685,7 +1676,7 @@ this function may change slightly when <tt><a href=Image.Image.html#colortable>I
 mirrors an image:
      <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_52.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_69.gif><img border=0 src=illustration_69.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->mirrorx();</td>
@@ -1712,7 +1703,7 @@ the new image object
 mirrors an image:
      <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_54.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_71.gif><img border=0 src=illustration_71.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->mirrory();</td>
@@ -1733,7 +1724,7 @@ mirrors an image:
 Recolor an image from intensity values.
 
 <p>    For each color an intensity is calculated, from r, g and b factors
-    (see <tt><a href=Image.image.html#grey>grey</a></tt>), this gives a value between 0 and max.
+    (see <tt><a href=Image.html>grey</a></tt>), this gives a value between 0 and max.
 
 <p>    The color is then calculated from the values given, v1 representing
     the intensity value of 0, vn representing max, and colors between
@@ -1741,7 +1732,7 @@ Recolor an image from intensity values.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_56.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_73.gif><img border=0 src=illustration_73.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->grey()->modify_by_intensity(1,0,0, 0,({255,0,0}),({0,255,0}));</td>
@@ -1766,9 +1757,9 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#grey>grey</a></tt>,
-     <tt><a href=Image.image.html#%60*>`*</a></tt>,
-     <tt><a href=Image.image.html#color>color</a></tt>
+<blockquote>     <tt><a href=Image.html>grey</a></tt>,
+     <tt><a href=Image.html>`*</a></tt>,
+     <tt><a href=Image.html>color</a></tt>
 </blockquote>
 
 <hr>
@@ -1790,7 +1781,7 @@ Gives a new image with the old image's size,
 
 <p>     Example: 
      <tt>->noise( ({0,({255,0,0}), 0.3,({0,255,0}), 0.6,({0,0,255}), 0.8,({255,255,0})}), 0.005,0,0,0.5 );</tt>
-     <br><img src=illustration_57.gif width=200 height=100>
+     <br><a href=illustrations.html#illustration_74.gif><img border=0 src=illustration_74.gif width=200 height=100></a>
 </blockquote>
 <h4>ARGUMENTS</h4>
 <blockquote><dl>
@@ -1807,7 +1798,7 @@ Gives a new image with the old image's size,
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#turbulence>turbulence</a></tt>
+<blockquote>     <tt><a href=Image.html>turbulence</a></tt>
 </blockquote>
 
 <hr>
@@ -1841,9 +1832,9 @@ the object called
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#paste_mask>paste_mask</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha>paste_alpha</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha_color>paste_alpha_color</a></tt>
+<blockquote>     <tt><a href=Image.html>paste_mask</a></tt>,
+     <tt><a href=Image.html>paste_alpha</a></tt>,
+     <tt><a href=Image.html>paste_alpha_color</a></tt>
 </blockquote>
 
 <hr>
@@ -1884,9 +1875,9 @@ the object called
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#paste_mask>paste_mask</a></tt>,
-     <tt><a href=Image.image.html#paste>paste</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha_color>paste_alpha_color</a></tt>
+<blockquote>     <tt><a href=Image.html>paste_mask</a></tt>,
+     <tt><a href=Image.html>paste</a></tt>,
+     <tt><a href=Image.html>paste_alpha_color</a></tt>
 </blockquote>
 
 <hr>
@@ -1933,9 +1924,9 @@ the object called
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#paste_mask>paste_mask</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha>paste_alpha</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha_color>paste_alpha_color</a></tt>
+<blockquote>     <tt><a href=Image.html>paste_mask</a></tt>,
+     <tt><a href=Image.html>paste_alpha</a></tt>,
+     <tt><a href=Image.html>paste_alpha_color</a></tt>
 </blockquote>
 
 <hr>
@@ -1977,9 +1968,9 @@ the object called
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#paste>paste</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha>paste_alpha</a></tt>,
-     <tt><a href=Image.image.html#paste_alpha_color>paste_alpha_color</a></tt>
+<blockquote>     <tt><a href=Image.html>paste</a></tt>,
+     <tt><a href=Image.html>paste_alpha</a></tt>,
+     <tt><a href=Image.html>paste_alpha_color</a></tt>
 </blockquote>
 
 <hr>
@@ -2019,8 +2010,8 @@ This function is new (april-97) and rather untested.
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#box>box</a></tt>,
-     <tt><a href=Image.image.html#setcolor>setcolor</a></tt>
+<blockquote>     <tt><a href=Image.html>box</a></tt>,
+     <tt><a href=Image.html>setcolor</a></tt>
 </blockquote>
 
 <hr>
@@ -2079,8 +2070,8 @@ Rotates an image a certain amount of degrees (360
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_59.gif width=87 height=88></td>
-     <td><img src=illustration_60.gif width=87 height=88></td>
+     <td><a href=illustrations.html#illustration_76.gif><img border=0 src=illustration_76.gif width=87 height=88></a></td>
+     <td><a href=illustrations.html#illustration_77.gif><img border=0 src=illustration_77.gif width=87 height=88></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->rotate(15,255,0,0);</td>
@@ -2091,7 +2082,7 @@ Rotates an image a certain amount of degrees (360
      image border pixels rather then filling with 
      the given or current color.
 
-<p>     This rotate uses the <tt><a href=Image.image.html#skewx>skewx</a></tt>() and <tt><a href=Image.image.html#skewy>skewy</a></tt>() functions.
+<p>     This rotate uses the <tt><a href=Image.html>skewx</a></tt>() and <tt><a href=Image.html>skewy</a></tt>() functions.
 </blockquote>
 <h4>ARGUMENTS</h4>
 <blockquote><dl>
@@ -2124,7 +2115,7 @@ rotates an image counter-clockwise, 90 degrees.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_62.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_79.gif><img border=0 src=illustration_79.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->rotate_ccw();</td>
@@ -2152,7 +2143,7 @@ rotates an image clockwise, 90 degrees.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_64.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_81.gif><img border=0 src=illustration_81.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->rotate_cw();</td>
@@ -2242,9 +2233,9 @@ Selects the best colors to represent the image.
 <p>
      <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_66.gif width=67 height=67></td>
-     <td><img src=illustration_67.gif width=67 height=67></td>
-     <td><img src=illustration_68.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_83.gif><img border=0 src=illustration_83.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_84.gif><img border=0 src=illustration_84.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_85.gif><img border=0 src=illustration_85.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>2</td>
@@ -2267,14 +2258,14 @@ an array of colors
 
 <h4>NOTE</h4>
 <blockquote>
-this function may change somewhat when <tt><a href=Image.Image.html#colortable>Image::colortable</a></tt>
+this function may change somewhat when <tt><a href=Image.html>Image::colortable</a></tt>
      is implemented (pike 0.6, probably)
 </blockquote>
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#map_fast>map_fast</a></tt>,
-     <tt><a href=Image.image.html#select_colors>select_colors</a></tt>
+<blockquote>     <tt><a href=Image.html>map_fast</a></tt>,
+     <tt><a href=Image.html>select_colors</a></tt>
 </blockquote>
 
 <hr>
@@ -2296,7 +2287,7 @@ Makes an grey-scale image, for alpha-channel use.
     The image is scanned from the given pixel,
     filled with 255 if the color is the same,
     or 255 minus distance in the colorcube, squared, rightshifted
-    8 steps (see <tt><a href=Image.image.html#distancesq>distancesq</a></tt>).
+    8 steps (see <tt><a href=Image.html>distancesq</a></tt>).
 
 <p>    When the edge distance is reached, the scan is stopped.
     Default edge value is 30.
@@ -2318,7 +2309,7 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#distancesq>distancesq</a></tt>
+<blockquote>     <tt><a href=Image.html>distancesq</a></tt>
 </blockquote>
 
 <hr>
@@ -2403,8 +2394,8 @@ Skews an image an amount of pixels or a factor;
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_70.gif width=82 height=67></td>
-     <td><img src=illustration_71.gif width=82 height=67></td>
+     <td><a href=illustrations.html#illustration_87.gif><img border=0 src=illustration_87.gif width=82 height=67></a></td>
+     <td><a href=illustrations.html#illustration_88.gif><img border=0 src=illustration_88.gif width=82 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->skewx(15,255,0,0);</td>
@@ -2456,8 +2447,8 @@ Skews an image an amount of pixels or a factor;
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_73.gif width=67 height=82></td>
-     <td><img src=illustration_74.gif width=67 height=82></td>
+     <td><a href=illustrations.html#illustration_90.gif><img border=0 src=illustration_90.gif width=67 height=82></a></td>
+     <td><a href=illustrations.html#illustration_91.gif><img border=0 src=illustration_91.gif width=67 height=82></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->skewy(15,255,0,0);</td>
@@ -2511,7 +2502,7 @@ Makes a black-white image.
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_76.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_93.gif><img border=0 src=illustration_93.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>->threshold(90,100,110);</td>
@@ -2533,7 +2524,7 @@ the new image object
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#grey>grey</a></tt>
+<blockquote>     <tt><a href=Image.html>grey</a></tt>
 </blockquote>
 
 <hr>
@@ -2582,9 +2573,9 @@ the calculated string
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#tozbgr>tozbgr</a></tt>,
-     <tt><a href=Image.image.html#to8bit>to8bit</a></tt>,
-     <tt><a href=Image.image.html#tobitmap>tobitmap</a></tt>
+<blockquote>     <tt><a href=Image.html>tozbgr</a></tt>,
+     <tt><a href=Image.html>to8bit</a></tt>,
+     <tt><a href=Image.html>tobitmap</a></tt>
 </blockquote>
 
 <hr>
@@ -2614,10 +2605,10 @@ the calculated string
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#tozbgr>tozbgr</a></tt>,
-     <tt><a href=Image.image.html#to8bit>to8bit</a></tt>,
-     <tt><a href=Image.image.html#to8bit_rgbcube>to8bit_rgbcube</a></tt>,
-     <tt><a href=Image.image.html#cast>cast</a></tt>
+<blockquote>     <tt><a href=Image.html>tozbgr</a></tt>,
+     <tt><a href=Image.html>to8bit</a></tt>,
+     <tt><a href=Image.html>to8bit_rgbcube</a></tt>,
+     <tt><a href=Image.html>cast</a></tt>
 </blockquote>
 
 <hr>
@@ -2666,11 +2657,11 @@ the GIF data
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#gif_begin>gif_begin</a></tt>,
-     <tt><a href=Image.image.html#gif_add>gif_add</a></tt>,
-     <tt><a href=Image.image.html#gif_end>gif_end</a></tt>,
-     <tt><a href=Image.image.html#toppm>toppm</a></tt>,
-     <tt><a href=Image.image.html#fromgif>fromgif</a></tt>
+<blockquote>     <tt><a href=Image.html>gif_begin</a></tt>,
+     <tt><a href=Image.html>gif_add</a></tt>,
+     <tt><a href=Image.html>gif_end</a></tt>,
+     <tt><a href=Image.html>toppm</a></tt>,
+     <tt><a href=Image.html>fromgif</a></tt>
 </blockquote>
 
 <hr>
@@ -2684,8 +2675,9 @@ the GIF data
 
 
 <blockquote>
-Returns PPM (P6, binary pixmap) data from the
-     current image object.
+<b>compability method</b> - do not use in new programs.
+     
+     See <tt><a href=Image.PNM.html#encode>Image.PNM.encode</a></tt>().
 </blockquote>
 <h4>RETURNS</h4>
 
@@ -2694,12 +2686,6 @@ Returns PPM (P6, binary pixmap) data from the
 PPM data
 </blockquote>
 
-
-<h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#frompnm>frompnm</a></tt>,
-     <tt><a href=Image.image.html#fromgif>fromgif</a></tt>
-</blockquote>
-
 <hr>
 <a name=tuned_box> </a>
 <h4>SYNOPSIS</h4>
@@ -2720,8 +2706,8 @@ Draws a filled rectangle with colors (and alpha values) tuned
 
 <p>     <table><tr valign=center>
      <td><img src=lena.gif width=67 height=67></td>
-     <td><img src=illustration_78.gif width=67 height=67></td>
-     <td><img src=illustration_79.gif width=67 height=67></td>
+     <td><a href=illustrations.html#illustration_95.gif><img border=0 src=illustration_95.gif width=67 height=67></a></td>
+     <td><a href=illustrations.html#illustration_96.gif><img border=0 src=illustration_96.gif width=67 height=67></a></td>
      </tr><tr valign=center>
      <td>original</td>
      <td>solid tuning<br>(blue,red,green,yellow)</td>
@@ -2772,7 +2758,7 @@ gives a new image with the old image's size,
 
 <p>     Example: <br>
      <tt>->turbulence( ({0,({229,204,204}), 0.9,({229,20,20}), 0.9,0}) );</tt>
-     <br><img src=illustration_80.gif width=200 height=100>
+     <br><a href=illustrations.html#illustration_97.gif><img border=0 src=illustration_97.gif width=200 height=100></a>
 </blockquote>
 <h4>ARGUMENTS</h4>
 <blockquote><dl>
@@ -2791,7 +2777,7 @@ gives a new image with the old image's size,
 
 
 <h4>SEE ALSO</h4>
-<blockquote>     <tt><a href=Image.image.html#noise>noise</a></tt>
+<blockquote>     <tt><a href=Image.html>noise</a></tt>
 </blockquote>
 
 <hr>
diff --git a/src/modules/Image/encodings/Makefile.in b/src/modules/Image/encodings/Makefile.in
index 0a608fefce2b4049e2ed3d856c3157abff9a0486..6f6897524eddc45a16700e667cc1228a4b5dbb22 100644
--- a/src/modules/Image/encodings/Makefile.in
+++ b/src/modules/Image/encodings/Makefile.in
@@ -1,7 +1,8 @@
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../../..:../../..
 GIF_OBJS = gif.o gif_lzw.o
-OBJS=gif.a
+PNM_OBJS = pnm.o 
+OBJS=gif.a pnm.a
 
 @SET_MAKE@
 
@@ -17,6 +18,10 @@ gif.a : $(GIF_OBJS)
 	rm -f gif.a
 	ar cq gif.a $(GIF_OBJS)
 
+pnm.a : $(PNM_OBJS)
+	rm -f pnm.a
+	ar cq pnm.a $(PNM_OBJS)
+
 depend:
 	gcc -MM $(PREFLAGS) $(SRCDIR)/*.c | $(TMP_BINDIR)/fixdepends.sh $(SRCDIR)
 
diff --git a/src/modules/Image/encodings/pnm.c b/src/modules/Image/encodings/pnm.c
new file mode 100644
index 0000000000000000000000000000000000000000..f65c71698f0d0a11d98f04536215e131d178b5cc
--- /dev/null
+++ b/src/modules/Image/encodings/pnm.c
@@ -0,0 +1,308 @@
+/* $Id: pnm.c,v 1.1 1997/11/02 03:42:38 mirar Exp $ */
+
+/*
+**! module Image
+**! note
+**!	$Id: pnm.c,v 1.1 1997/11/02 03:42:38 mirar Exp $
+**! submodule PNM
+**!
+**!	This submodule keep the PNM encode/decode capabilities
+**!	of the <ref>Image</ref> module.
+**!
+**!	PNM is a common image storage format on unix systems,
+**!	and is a very simple format.
+**!
+**!	This format doesn't use any color palette.
+**!
+**!	The format is divided into seven subformats;
+**!
+**!	<pre>
+**!	P1(PBM) - ascii bitmap (only two colors)
+**!	P2(PGM) - ascii greymap (only grey levels)
+**!	P3(PPM) - ascii truecolor
+**!	P4(PBM) - binary bitmap 
+**!	P5(PGM) - binary greymap 
+**!	P6(PPM) - binary truecolor
+** 	P7 - binary truecolor (used by xv for thumbnails)
+**!	</pre>
+**!
+**! see also: Image, Image.image, Image.GIF
+*/
+
+#include <math.h>
+#include <ctype.h>
+
+#include "stralloc.h"
+#include "global.h"
+RCSID("$Id: pnm.c,v 1.1 1997/11/02 03:42:38 mirar Exp $");
+#include "pike_macros.h"
+#include "object.h"
+#include "constants.h"
+#include "interpret.h"
+#include "svalue.h"
+#include "threads.h"
+#include "array.h"
+#include "error.h"
+
+
+#include "image.h"
+#include "builtin_functions.h"
+
+extern struct program *image_colortable_program;
+extern struct program *image_program;
+
+
+/* internal read foo */
+
+static INLINE unsigned char getnext(struct pike_string *s,INT32 *pos)
+{
+   if (*pos>=s->len) return 0;
+   if (s->str[(*pos)]=='#')
+      for (;*pos<s->len && ISSPACE(s->str[*pos]);(*pos)++);
+   return s->str[(*pos)++];
+}
+
+static INLINE void skip_to_eol(struct pike_string *s,INT32 *pos)
+{
+   for (;*pos<s->len && s->str[*pos]!=10;(*pos)++);
+}
+
+static INLINE unsigned char getnext_skip_comment(struct pike_string *s,INT32 *pos)
+{
+   unsigned char c;
+   while ((c=getnext(s,pos))=='#')
+      skip_to_eol(s,pos);
+   return c;
+}
+
+static INLINE void skipwhite(struct pike_string *s,INT32 *pos)
+{
+   while (*pos<s->len && 
+	  ( ISSPACE(s->str[*pos]) ||
+	    s->str[*pos]=='#'))
+      getnext_skip_comment(s,pos);
+}
+
+static INLINE INT32 getnextnum(struct pike_string *s,INT32 *pos)
+{
+   INT32 i;
+   skipwhite(s,pos);
+   i=0;
+   while (*pos<s->len &&
+	  s->str[*pos]>='0' && s->str[*pos]<='9')
+   {
+      i=(i*10)+s->str[*pos]-'0';
+      getnext(s,pos);
+   }
+   return i;
+}
+
+/*
+**! method object decode(string data)
+**!	Decodes PNM (PBM/PGM/PPM) data and creates an image object.
+**! 	
+**! see also: encode
+**!
+**! note
+**!	This function may throw errors upon illegal PNM data.
+**!
+**! returns the decoded image as an image object
+*/
+
+void img_pnm_decode(INT32 args)
+{
+   INT32 type,c=0,maxval=255;
+   INT32 pos=0,x,y,i,n;
+   struct object *o;
+   struct image *new;
+   rgb_group *d;
+
+   struct pike_string *s;
+
+   if (args<1 ||
+       sp[-args].type!=T_STRING)
+      error("Image.PNM.decode(): Illegal arguments\n");
+
+   s=sp[-args].u.string;
+
+   skipwhite(s,&pos);
+   if (getnext(s,&pos)!='P') 
+      error("Image.PNM.decode(): given string is not a pnm file\n"); 
+   type=getnext(s,&pos);
+   if (type<'1'||type>'6')
+      error("Image.PNM.decode(): given pnm data has illegal or unknown type\n"); 
+   x=getnextnum(s,&pos);
+   y=getnextnum(s,&pos);
+   if (x<=0||y<=0) 
+      error("Image.PNM.decode(): given pnm data has illegal size\n"); 
+   if (type=='3'||type=='2'||type=='6'||type=='5')
+      maxval=getnextnum(s,&pos);
+
+   push_int(x);
+   push_int(y);
+
+   o=clone_object(image_program,2);
+   new=(struct image*)get_storage(o,image_program);
+   if (!new) 
+      error("Image.PNM.decode(): cloned image object isn't an image (internal)\n");
+
+   if (type=='1'||type=='2'||type=='3')
+   {
+     skipwhite(s,&pos);
+   }
+   else
+   {
+     skip_to_eol(s,&pos);
+     pos++;
+   }
+   d=new->img;
+   n=x*y;
+   i=0;
+
+   while (n--)
+   {
+      switch (type)
+      {
+	 case '1':
+	    c=getnextnum(s,&pos);
+	    d->r=d->g=d->b=
+	       (unsigned char)~(c*255);
+	    break;
+	 case '2':
+	    c=getnextnum(s,&pos);
+	    d->r=d->g=d->b=
+	       (unsigned char)((c*255L)/maxval);
+	    break;
+	 case '3':
+	    d->r=(unsigned char)((getnextnum(s,&pos)*255L)/maxval);
+	    d->g=(unsigned char)((getnextnum(s,&pos)*255L)/maxval);
+	    d->b=(unsigned char)((getnextnum(s,&pos)*255L)/maxval);
+	    break;
+	 case '4':
+	    if (!i) c=getnext(s,&pos),i=8;
+	    d->r=d->g=d->b=
+	       (unsigned char)~(((c>>7)&1)*255);
+	    c<<=1;
+	    i--;
+	    break;
+	 case '5':
+	    c=getnext(s,&pos);
+	    d->r=d->g=d->b=
+	       (unsigned char)((c*255L)/maxval);
+	    break;
+	 case '6':
+	    d->r=(unsigned char)((getnext(s,&pos)*255L)/maxval);
+	    d->g=(unsigned char)((getnext(s,&pos)*255L)/maxval);
+	    d->b=(unsigned char)((getnext(s,&pos)*255L)/maxval);
+	    break;
+      }
+      d++;
+   }
+   pop_n_elems(args);
+   push_object(o);
+}
+
+/*
+**! method string encode(object image)
+**! method string encode_binary(object image)
+**  method string encode_ascii(object image)
+**  method string encode_P1(object image)
+**  method string encode_P2(object image)
+**  method string encode_P3(object image)
+**  method string encode_P4(object image)
+**  method string encode_P5(object image)
+**! method string encode_P6(object image)
+**  method string encode_P7(object image)
+**!	Make a complete PNM file from an image.
+**!
+**!	<ref>encode_binary</ref>() and <ref>encode_ascii</ref>()
+**!	uses the most optimized encoding for this image (bitmap, grey
+**!	or truecolor) - P4, P5 or P6 respective P1, P2 or P3.
+**!
+**!	<ref>encode</ref>() maps to <ref>encode_binary</ref>().
+**! 	
+**! see also: decode
+**!
+**! returns the encoded image as a string
+**!
+**! bugs
+**!	Currently only supports type P5 (binary grey) and
+**!	P6 (binary truecolor). 
+*/
+
+void img_pnm_encode_P6(INT32 args)
+{
+   char buf[80];
+   struct pike_string *a,*b;
+   struct image *img;
+
+   if (args<1 ||
+       sp[-args].type!=T_OBJECT ||
+       !(img=(struct image*)get_storage(sp[-args].u.object,image_program)))
+      error("Image.PNM.encode_P6(): Illegal arguments\n");
+   if (!img->img)
+      error("Image.PNM.encode_P6(): Given image is empty\n");
+
+   sprintf(buf,"P6\n%d %d\n255\n",img->xsize,img->ysize);
+   a=make_shared_string(buf);
+   if (sizeof(rgb_group)==3)
+      b=make_shared_binary_string((char*)img->img,
+				  img->xsize*img->ysize*3);
+   else
+   {
+      char *c;
+      int n=img->xsize*img->ysize;
+      rgb_group *s=img->img;
+      b=begin_shared_string(n*3);
+      while (n--)
+      {
+	 *(c++)=s->r;
+	 *(c++)=s->g;
+	 *(c++)=s->b;
+	 s++;
+      }
+      b=end_shared_string(b);
+   }
+   pop_n_elems(args);
+   push_string(add_shared_strings(a,b));
+   free_string(a);
+   free_string(b);
+}
+
+
+void img_pnm_encode_binary(INT32 args)
+{
+   img_pnm_encode_P6(args);
+}
+
+
+struct program *image_pnm_module_program=NULL;
+
+void init_image_pnm(void)
+{
+   start_new_program();
+   
+   add_function("encode",img_pnm_encode_binary,
+		"function(object:string)",0);
+   add_function("encode_binary",img_pnm_encode_binary,
+		"function(object:string)",0);
+   add_function("encode_P6",img_pnm_encode_P6,
+		"function(object:string)",0);
+
+   add_function("decode",img_pnm_decode,
+		"function(string:object)",0);
+
+   image_pnm_module_program=end_program();
+   push_object(clone_object(image_pnm_module_program,0));
+   add_constant(make_shared_string("PNM"),sp-1,0);
+   pop_stack();
+}
+
+void exit_image_pnm(void)
+{
+  if(image_pnm_module_program)
+  {
+    free_program(image_pnm_module_program);
+    image_pnm_module_program=0;
+  }
+}
diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c
index 3e966d4aa4f768e1e1adb0b630b2696643a62d77..c2d1179c405547053081b1071a8fbdb1499b747a 100644
--- a/src/modules/Image/image.c
+++ b/src/modules/Image/image.c
@@ -1,9 +1,9 @@
-/* $Id: image.c,v 1.49 1997/10/27 22:41:20 mirar Exp $ */
+/* $Id: image.c,v 1.50 1997/11/02 03:43:23 mirar Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: image.c,v 1.49 1997/10/27 22:41:20 mirar Exp $
+**!	$Id: image.c,v 1.50 1997/11/02 03:43:23 mirar Exp $
 **! class image
 **!
 **!	The main object of the <ref>Image</ref> module, this object
@@ -102,7 +102,7 @@
 
 #include "stralloc.h"
 #include "global.h"
-RCSID("$Id: image.c,v 1.49 1997/10/27 22:41:20 mirar Exp $");
+RCSID("$Id: image.c,v 1.50 1997/11/02 03:43:23 mirar Exp $");
 #include "pike_macros.h"
 #include "object.h"
 #include "constants.h"
@@ -2865,6 +2865,8 @@ void init_colortable_programs(void);
 void exit_colortable(void);
 void init_image_gif(void);
 void exit_image_gif(void);
+void init_image_pnm(void);
+void exit_image_pnm(void);
 
 void pike_module_init(void)
 {
@@ -3072,6 +3074,7 @@ void pike_module_init(void)
    init_colortable_programs();
 
    init_image_gif();
+   init_image_pnm();
 }
 
 void pike_module_exit(void) 
@@ -3085,6 +3088,7 @@ void pike_module_exit(void)
   exit_colortable();
 
   exit_image_gif();
+  exit_image_pnm();
 }
 
 
diff --git a/src/modules/Image/pnm.c b/src/modules/Image/pnm.c
index 022b3e4a7d26f49cdf10f08c88ff591e26fbc05d..502f10392865e79d5bd3c434b879c489058db36f 100644
--- a/src/modules/Image/pnm.c
+++ b/src/modules/Image/pnm.c
@@ -1,9 +1,9 @@
-/* $Id: pnm.c,v 1.6 1997/10/27 22:41:27 mirar Exp $ */
+/* $Id: pnm.c,v 1.7 1997/11/02 03:42:36 mirar Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: pnm.c,v 1.6 1997/10/27 22:41:27 mirar Exp $
+**!	$Id: pnm.c,v 1.7 1997/11/02 03:42:36 mirar Exp $
 **! class image
 */
 
@@ -26,173 +26,51 @@
 
 #define THIS ((struct image *)(fp->current_storage))
 #define THISOBJ (fp->current_object)
-#define pixel(_img,x,y) ((_img)->img[(x)+(y)*(_img)->xsize])
 
-
-static INLINE unsigned char getnext(struct pike_string *s,INT32 *pos)
-{
-   if (*pos>=s->len) return 0;
-   if (s->str[(*pos)]=='#')
-      for (;*pos<s->len && ISSPACE(s->str[*pos]);(*pos)++);
-   return s->str[(*pos)++];
-}
-
-static INLINE void skip_to_eol(struct pike_string *s,INT32 *pos)
-{
-   for (;*pos<s->len && s->str[*pos]!=10;(*pos)++);
-}
-
-static INLINE unsigned char getnext_skip_comment(struct pike_string *s,INT32 *pos)
-{
-   unsigned char c;
-   while ((c=getnext(s,pos))=='#')
-      skip_to_eol(s,pos);
-   return c;
-}
-
-static INLINE void skipwhite(struct pike_string *s,INT32 *pos)
-{
-   while (*pos<s->len && 
-	  ( ISSPACE(s->str[*pos]) ||
-	    s->str[*pos]=='#'))
-      getnext_skip_comment(s,pos);
-}
-
-static INLINE INT32 getnextnum(struct pike_string *s,INT32 *pos)
-{
-   INT32 i;
-   skipwhite(s,pos);
-   i=0;
-   while (*pos<s->len &&
-	  s->str[*pos]>='0' && s->str[*pos]<='9')
-   {
-      i=(i*10)+s->str[*pos]-'0';
-      getnext(s,pos);
-   }
-   return i;
-}
-
-static char* img_frompnm(struct pike_string *s)
-{
-   struct image new;
-   INT32 type,c=0,maxval=255;
-   INT32 pos=0,x,y,i;
-
-   skipwhite(s,&pos);
-   if (getnext(s,&pos)!='P') return "not pnm"; /* not pnm */
-   type=getnext(s,&pos);
-   if (type<'1'||type>'6') return "unknown type"; /* unknown type */
-   new.xsize=getnextnum(s,&pos);
-   new.ysize=getnextnum(s,&pos);
-   if (new.xsize<=0||new.ysize<=0) return "illegal size"; /* illegal size */
-   if (type=='3'||type=='2'||type=='6'||type=='5')
-      maxval=getnextnum(s,&pos);
-   new.img=malloc(new.xsize*new.ysize*sizeof(rgb_group)+1);
-   if (!new.img) error("Out of memory.\n");
-
-   if (type=='1'||type=='2'||type=='3')
-   {
-     skipwhite(s,&pos);
-   }
-   else
-   {
-     skip_to_eol(s,&pos);
-     pos++;
-   }
-   for (y=0; y<new.ysize; y++)
-   {
-      for (i=0,x=0; x<new.xsize; x++)
-      {
-         switch (type)
-	 {
-	    case '1':
-	       c=getnextnum(s,&pos);
-               pixel(&new,x,y).r=pixel(&new,x,y).g=pixel(&new,x,y).b=
-	          (unsigned char)~(c*255);
-	       break;
-	    case '2':
-	       c=getnextnum(s,&pos);
-               pixel(&new,x,y).r=pixel(&new,x,y).g=pixel(&new,x,y).b=
-	          (unsigned char)((c*255L)/maxval);
-	       break;
-	    case '3':
-	       pixel(&new,x,y).r=(unsigned char)((getnextnum(s,&pos)*255L)/maxval);
-	       pixel(&new,x,y).g=(unsigned char)((getnextnum(s,&pos)*255L)/maxval);
-	       pixel(&new,x,y).b=(unsigned char)((getnextnum(s,&pos)*255L)/maxval);
-	       break;
-	    case '4':
-	       if (!i) c=getnext(s,&pos),i=8;
-               pixel(&new,x,y).r=pixel(&new,x,y).g=pixel(&new,x,y).b=
-	          (unsigned char)~(((c>>7)&1)*255);
-	       c<<=1;
-	       i--;
-	       break;
-	    case '5':
-	       c=getnext(s,&pos);
-               pixel(&new,x,y).r=pixel(&new,x,y).g=pixel(&new,x,y).b=
-	          (unsigned char)((c*255L)/maxval);
-	       break;
-	    case '6':
-	       pixel(&new,x,y).r=(unsigned char)((getnext(s,&pos)*255L)/maxval);
-	       pixel(&new,x,y).g=(unsigned char)((getnext(s,&pos)*255L)/maxval);
-	       pixel(&new,x,y).b=(unsigned char)((getnext(s,&pos)*255L)/maxval);
-	       break;
-	 }
-      }
-   }
-   if (THIS->img) free(THIS->img);
-   THIS->xsize=new.xsize;
-   THIS->ysize=new.ysize;
-   THIS->img=new.img;
-   return NULL;
-}
+extern struct program *image_program;
 
 /*
 **! method string toppm()
-**!	Returns PPM (P6, binary pixmap) data from the
-**!     current image object.
+**!	<b>compability method</b> - do not use in new programs.
+**!	
+**!	See <ref>Image.PNM.encode</ref>().
+**!
 **! returns PPM data
-**! see also: frompnm, fromgif
 **!
 **! method object|string frompnm(string pnm)
 **! method object|string fromppm(string pnm)
-**!	Reads a PNM (PBM, PGM or PPM in ascii or binary)
-**!	to the called image object.
+**!	<b>compability method</b> - do not use in new programs.
+**!	
+**!	See <ref>Image.PNM.decode</ref>().
 **!
-**!	The method accepts P1 through P6 type of PNM data.
-**!
-**!	"fromppm" is an alias for "frompnm".
 **! returns the called object or a hint of what wronged.
 **! arg string pnm
 **!	pnm data, as a string
-**! see also: toppm, fromgif
 */
 
 void image_toppm(INT32 args)
 {
-   char buf[80];
-   struct pike_string *a,*b;
-   
    pop_n_elems(args);
-   if (!THIS->img) { error("no image\n");  return; }
-   sprintf(buf,"P6\n%d %d\n255\n",THIS->xsize,THIS->ysize);
-   a=make_shared_string(buf);
-   b=make_shared_binary_string((char*)THIS->img,
-			       THIS->xsize*THIS->ysize*3);
-   push_string(add_shared_strings(a,b));
-   free_string(a);
-   free_string(b);
+   
+   THISOBJ->refs++;
+   push_object(THISOBJ);
+
+   img_pnm_encode_binary(1);
 }
 
 void image_frompnm(INT32 args)
 {
-   char *s;
-   if (args<1||
-       sp[-args].type!=T_STRING)
-      error("Illegal argument to image->frompnm()\n");
-   s=img_frompnm(sp[-args].u.string);
-   pop_n_elems(args);
-   if (!s) { push_object(THISOBJ); THISOBJ->refs++; }
-   else push_string(make_shared_string(s));
+   struct image *img;
+   img_pnm_decode(args);
+   
+   img=(struct image*)get_storage(sp[-1].u.object,image_program);
+   if (THIS->img) free(THIS->img);
+   *THIS=*img;
+   THIS->img=malloc(img->xsize*img->ysize*sizeof(rgb_group)+1);
+   if (!THIS->img) error("out of memory\n");
+   MEMCPY(THIS->img,img->img,img->xsize*img->ysize*sizeof(rgb_group));
+   pop_n_elems(1);
+   THISOBJ->refs++;
+   push_object(THISOBJ);
 }