I try to copy a range of pixel rows from one .png image (RGB mode) into another one. With the red and green components it works just fine. But it seems that the blue component will never be copied, so that the resulting image has different color than the original one. My code looks like below:
row = 200
width = 1000
color = 3
for r in range(100, 150):
for c in range(width):
for cl in range(color):
imar1[row][c][cl] = imar[r][c][cl]
row += 1
imar is the numpy array of the original image, and imar1 that of the new one which was initialized to a white image (all pixels are white, i.e. (255,255,255)). The resulting image has 255 for the blue component of all pixels. Can someone give me hint on the reason or solution? Many thanks in advance!
Weichao