--- a
+++ b/src/vips/transform_image_build.c
@@ -0,0 +1,73 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#include <parser/tparser.h>
+#include <vips/vips.h>
+
+#include "transform.h"
+
+/* Generate function. Fill this region with pixels.
+ */
+static int
+transform_image_build_gen( REGION *or, void *dummy, pt_transform *trn )
+{
+	Rect *r = &or->valid;
+	int le = r->left;
+	int to = r->top;
+	int ri = IM_RECT_RIGHT( r );
+	int bo = IM_RECT_BOTTOM( r );
+
+	int x, y;
+
+	for( y = to; y < bo; y++ ) {
+		double *q = (double *) IM_REGION_ADDR( or, le, y );
+
+		for( x = le; x < ri; x++ ) {
+			double xp, yp;
+
+			/*transform_coordinates( trn, x, y, &xp, &yp );*/
+            panoTransformInverse(trn, x,y, &xp,&yp);
+            /*printf("%f, %f  ", xs, ys);*/
+
+			q[0] = xp;
+			q[1] = yp;
+			q += 2;
+		}
+          
+		/*printf("\n", xs, ys);*/
+	}
+
+	return( 0 );
+}
+
+/* Make a two band image ... band 0 is x coordinates, band 1 is y
+ * coordinates.
+ */
+int
+transform_image_build( IMAGE *out, 
+	pt_transform *trn, const int xsize, const int ysize )
+{
+	if( xsize <= 0 || ysize <= 0 ) { 
+		im_error( "im_transform_image_build", _( "bad size" ) ); 
+		return( -1 ); 
+	}
+	if( im_poutcheck( out ) )
+		return( -1 );
+
+	im_initdesc( out, xsize, ysize, 2, IM_BBITS_DOUBLE, IM_BANDFMT_DOUBLE, 
+		IM_CODING_NONE, IM_TYPE_MULTIBAND, 1.0, 1.0, 0, 0 );
+
+	if( im_demand_hint( out, IM_ANY, NULL ) )
+		return( -1 );
+	
+	if( im_generate( out, 
+		NULL, transform_image_build_gen, NULL, trn, NULL ) )
+		return( -1 );
+
+	return( 0 );
+}