Okay, I messed around with it and came up with something like this:
import PIL.Image
def zoom(img, zoom):
w, h = img.size
print(w,h)
zoom2 = zoom * 2
return img.resize((w*zoom, h*zoom), PIL.Image.NEAREST)
green = 0
red = 0
blue = 0
img = np.zeros([10,10,3], dtype=np.uint8)
for i in range(10):
green += 52
blue += 45
green %= 256
blue %= 256
img[i,:,1:] = [blue,green]
blue = 0
for j in range(10):
red += 47
blue += 48
red %= 256
blue %= 256
img[:,j,0] = red
img[:,j,2] = blue
grid = np.tile( img, [5, 5, 1])
grid = grid.astype(np.uint8)
zoom(PIL.Image.fromarray(grid), 8)
Resulting in this picture:

This only makes a 50x50 grid, but it's pretty hard to see the grid on a larger image. I might try doing my segmentation program another way. One nice thing about this is that you can "debug" half of the colors by commenting out either the code that sets the x color values, or the code that sets the y color values.