PNG изображения показывают черный - PullRequest
0 голосов
/ 06 февраля 2020

Я пытаюсь отобразить 8-битное изображение в формате png, используя PIL (библиотека подушек)

width_image = 384
height_image = 216
depth_image = 3
image_datatype = np.uint8
# Fetch total number of images from the folder.
self.count_of_image = len(glob.glob1(folder_Path,"*.png"))

# Select the center image for display
self.current_image_number = round(self.count_of_image / 2)
self.display_number = self.current_image_number


image_array = np.ndarray([self.count_of_image, height_image, width_image, depth_image]).astype(image_datatype)

# load images here
for index_image in range(0, self.count_of_image):
    image_path = folder_Path + "/" + str(index_image) + ".png"
    modified_image = imread(image_path).astype(image_dtype)
    image_array[index_image, :modified_image.shape[0], :modified_image.shape[1], :modified_image.shape[2]] = modified_image

return image_array

Форма image_array равна (1, 216, 384, 3), а формаified_image - (216 , 384, 3)

Один и тот же код работает для изображений JPG, но для .PNG он показывает черный

Может кто-нибудь помочь .?

...