I convert the array of piskula obtained by using a PIllow in a three-dimensional NumPy array, and this code works fine with color images:
np.array(img.getdata(), np.uint8).reshape(img.size, img.size, 3)
But when it is black-and-white image, you receive the following error:
ValueError: cannot reshape array of size 784 into shape (28,28,3)
The problem is that the Pillow instead of three colors of a pixel produces a single. Get all arrays must be of the same dimension. How can I make it so that you can get three colors for each pixel in case of black-and-white image?