Aug-09-2022, 08:31 PM
(This post was last modified: Aug-09-2022, 08:32 PM by deanhystad.)
The problem is not adding the arrays, the problem is that one of the arrays has the wrong dtype. The dtype for base_image1 should be np.int8. You could have determined this by looking at the dtype for image1, or just use dtype from image1.
image = Image.open(path) image.putalpha(255) image1 = np.array(image) # Make larger numpy array of all zeroes base_image1 = np.zeros((605, 405, 4), dtype=image1.dtype)You can copy image1 into base_image1 without the extra addition step.
base_image1[x:(x+height),y:(y+width),:] = image1