'How to re-scale image between 0 and 1 using PIL?
There is a method in Keras called ImageDataGenerator that scales images, that would look liks this:
test_datagen = ImageDataGenerator(rescale=1./255)
I want to do the same scaling of an image, but using PIL. I have this code:
file_list = ['image1.jpg', 'image2.jpg']
for i in file_list:
test_image = image.load_img(i,target_size=(150,150))
images = image.img_to_array(test_image)
images = image.img_to_array(test_image)
images = np.expand_dims(images, axis=0)
Could someone show me how to add 'rescale the image' similar to that of ImageDataGenerator, using PIL? I can see the re-size parameter in the documentation here but not re-scale?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
