diff --git a/src/modules/image/Makefile.src b/src/modules/image/Makefile.src
index 5e719c90641b52a407033483bcf47a6cf9cc4e8c..3f7cb23d3ef031026bf8165a639288e114cd9dd8 100644
--- a/src/modules/image/Makefile.src
+++ b/src/modules/image/Makefile.src
@@ -4,7 +4,7 @@ PREFLAGS=$(DEFINES) -I$(SRCDIR) -I$(SRCDIR)/../.. -I../..
 CFLAGS=$(PREFLAGS) $(OTHERFLAGS) @DEFS@
 
 FILES =	image.o font.o quant.o lzw.o togif.o matrix.o pnm.o blit.o \
-	pattern.o
+	pattern.o dct.o
 
 image.a: $(FILES)
 	-rm -f image.a
diff --git a/src/modules/image/image.c b/src/modules/image/image.c
index ccf795823b9918141ea9feaed0610d61e970b035..6c346c1b6dd67f901823350a1f816c64a4c012e3 100644
--- a/src/modules/image/image.c
+++ b/src/modules/image/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.28 1996/11/30 13:14:35 law Exp $ */
+/* $Id: image.c,v 1.29 1996/12/01 00:01:13 law Exp $ */
 
 #include "global.h"
 
@@ -7,7 +7,7 @@
 
 #include "stralloc.h"
 #include "global.h"
-RCSID("$Id: image.c,v 1.28 1996/11/30 13:14:35 law Exp $");
+RCSID("$Id: image.c,v 1.29 1996/12/01 00:01:13 law Exp $");
 #include "types.h"
 #include "macros.h"
 #include "object.h"
@@ -121,7 +121,7 @@ static INLINE void img_line(INT32 x1,INT32 y1,INT32 x2,INT32 y2)
    {
       if (y1>y2) y1^=y2,y2^=y1,y1^=y2;
       if (x1<0||x1>=THIS->xsize||
-	  y2<0||y2>=THIS->ysize) return;
+	  y2<0||y1>=THIS->ysize) return;
       if (y1<0) y1=0;
       if (y2>=THIS->ysize) y2=THIS->ysize-1;
       for (;y1<=y2;y1++) setpixel_test(x1,y1);
@@ -1629,6 +1629,9 @@ void init_image_programs()
                 "function(array(float|int|array(int)),float|void,float|void,float|void,float|void:object)",0);
    add_function("turbulence",image_turbulence,
                 "function(array(float|int|array(int)),int|void,float|void,float|void,float|void,float|void:object)",0);
+
+   add_function("dct",image_dct,
+		"function(:object)",0);
 		
    set_init_callback(init_image_struct);
    set_exit_callback(exit_image_struct);
diff --git a/src/modules/image/image.h b/src/modules/image/image.h
index 486179a6be1c3005d16be53e2263f096e2a7010f..222d10773dbebfe59b53a99768c39b57374536c6 100644
--- a/src/modules/image/image.h
+++ b/src/modules/image/image.h
@@ -1,4 +1,4 @@
-/* $Id: image.h,v 1.11 1996/11/30 13:14:37 law Exp $ */
+/* $Id: image.h,v 1.12 1996/12/01 00:01:14 law Exp $ */
 
 #define MAX_NUMCOL 32768
 #define QUANT_MAP_BITS 4
@@ -26,6 +26,11 @@ typedef struct
    signed long r,g,b;
 } rgbl_group;
 
+typedef struct
+{
+   float r,g,b;
+} rgbd_group; /* use float, it gets so big otherwise... */
+
 struct image
 {
    rgb_group *img;
@@ -128,3 +133,7 @@ void image_frompnm(INT32 args);
 void image_noise(INT32 args);
 void image_turbulence(INT32 args);
 void image_noise_init(void);
+
+/* dct.c */
+
+void image_dct(INT32 args);
diff --git a/src/modules/image/matrix.c b/src/modules/image/matrix.c
index 0275b8cb77fa8d8a352e540f62c29eb27c8ebc26..a3bfc3655042986f451de500b79f8f5d709b2c90 100644
--- a/src/modules/image/matrix.c
+++ b/src/modules/image/matrix.c
@@ -1,4 +1,4 @@
-/* $Id: matrix.c,v 1.5 1996/11/30 13:14:39 law Exp $ */
+/* $Id: matrix.c,v 1.6 1996/12/01 00:01:15 law Exp $ */
 
 #include "global.h"
 
@@ -116,11 +116,6 @@ static INLINE int getrgbl(rgbl_group *rgb,INT32 args_start,INT32 args,char *name
 #define scale_add_pixel(dest,dx,src,sx,factor) \
    _scale_add_rgb(dest,src,factor)
 
-typedef struct
-{
-   double r,g,b;
-} rgbd_group;
-
 static INLINE void scale_add_line(rgbd_group *new,INT32 yn,INT32 newx,
 				  rgb_group *img,INT32 y,INT32 xsize,
 				  double py,double dx)