File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 16
16
import os
17
17
18
18
from flask import Flask
19
- import scipy .misc
19
+ from PIL import Image
20
+ import imageio
20
21
21
22
app = Flask (__name__ )
22
23
23
24
24
25
@app .route ('/' )
25
26
def resize ():
26
- """Demonstrates using scipy to resize an image."""
27
+ """Demonstrates using Pillow to resize an image."""
27
28
app_path = os .path .dirname (os .path .realpath (__file__ ))
28
29
image_path = os .path .join (app_path , 'assets/google_logo.jpg' )
29
- img = scipy .misc .imread (image_path )
30
- img_tinted = scipy .misc .imresize (img , (300 , 300 ))
30
+ img = Image .fromarray (imageio .imread (image_path ))
31
+ img_tinted = img .resize ((300 , 300 ))
32
+
31
33
output_image_path = os .path .join (
32
34
app_path , 'assets/resized_google_logo.jpg' )
33
35
# Write the tinted image back to disk
34
- scipy . misc . imsave (output_image_path , img_tinted )
36
+ imageio . imwrite (output_image_path , img_tinted )
35
37
return "Image resized."
36
38
37
39
Original file line number Diff line number Diff line change 1
1
Flask == 1.1.1
2
2
gunicorn == 20.0.4
3
+ imageio == 2.8.0
3
4
numpy == 1.18.2
4
- scipy == 1.2.0
5
5
pillow == 7.1.0
6
+ scipy == 1.4.1
You can’t perform that action at this time.
0 commit comments