text_plain_output_1.png
from PIL import Image, ImageOps  # Install pillow instead of PIL

import numpy as np

data = np.ndarray(shape=(48, 48, 1), dtype=np.float32)

image = Image.open('/kaggle/input/ahsan-model-3-testing-implementation/from_kaggle/dataset/sad/PrivateTest_568359.jpg').convert('RGB')

gray_image = image.convert('L')

size = (48, 48)
image = ImageOps.fit(gray_image, size, Image.Resampling.LANCZOS)

image_array = np.asarray(image)

image_array.shape