PIL: ValueError: unknown resampling filter, How to resize images uploaded on Flask?
问题 I'm making a web app using Flask, and I want to resize the images that are uploaded. I'm using PIL to do this, but an error is thrown. The process to do it is like this, but it seems inefficient: filename = secure_filename(form.image.data.filename) form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) img = Image.open(os.path.join(app.config['UPLOAD_FOLDER'],filename), 'r') img = img.resize(300, 300) img.save(filename, quality=100, optimize=True) What I'm trying to do is