Convert grayscale png to RGB png image
问题 I have a dataset of medical images in grayscale Png format which must be converted to RGB format. Tried many solutions but in vain. 回答1: If you want to just convert the format, the following method will help you: In python3, using PILLOW and Numpy: From PIL import Image import numpy as np im = Image.open(path/to/image, 'r').convert('L') im = np.stack((im,)*3, axis=-1) im = Image.fromarray(im) im.save(path/to/save) But if you want to colorize the image, know that colorization is an well-known