Why does tf.keras.utils.image_dataset_from_directory load images differently than other methods?

When I return an image loaded with tf.keras.utils.image_dataset_from_directory as an array, the array is not identical to the array returned from tf.keras.utils.load_img. Why is this happening? I am setting image size to the original size of the image, so there should be no preprocessing going on.

I have also tried loading the image with PIL and cv2, and get the same result as tf.keras.utils.load_img.

@Vegard_Skagestad,

The general use case of using the image_dataset_from_directory is to load the multiple images from the directory and prepare them for training by resizing them to a fixed size. However, when the original size is provided to the function, the image should not be altered.

Thank you!