strange coloring of a tiled raster image

Hello,

I wish to plot 4 different raster images within a figure, and later

plot registered lines highlighting certain features of them.

Here is the code to read one image and plot it, works as expcted:

img = Image.open(sys.argv[1])

img1 = numpy.asarray(img)

pylab.figure()

pylab.imshow(img1)

pylab.savefig(’_imgok.jpg’)

Now, make a double-sized image array, and tile the original image into it:

pylab.figure()

YRES = img1.shape[0]

XRES = img1.shape[1]

twoimg = numpy.zeros((2YRES,2XRES,3))

#twoimg =
numpy.empty((2YRES,2XRES,3),numpy.uint32)

twoimg[0:YRES,0:XRES,:] = img1

twoimg[0:YRES,XRES:2*XRES,:] = img1

twoimg[YRES:2*YRES,0:XRES,:] = img1

pylab.imshow(twoimg, origin=‘upper’, interpolation=‘nearest’)

pylab.gray()

pylab.savefig(’_imgproblem.jpg’)

It comes out strangely colored, vaguely as if the red and green channels were

swapped. However, that’s not it (I tried swapping).

This is with maaplib-0.91 (-2?) on a mac 10.4.11, and I think

the backend is GTKAgg

Thanks for any advice

(recent convert from matlab, quite happy…)

···

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com