python batch modify the size of the picture, and save the specified path of the realization of the method
As shown below:
import os from PIL import Image filename = ("D:\\\Work\\\\process\\\\sample processing\\\polyu-all-train") base_dir = "D:\\\Work\\\\\process\\\\ sample processing\\\\polyu-all-train\\\" new_dir = "D:\\\Work\\\\\process\\\\ sample processing\\\polyu\\\\" size_m = 128 size_n = 128 for img in filename: image = (base_dir + img) image_size = ((size_m, size_n),) image_size.save(new_dir+ img)
Above this python batch modify the size of the picture, and save the specified path to achieve the method is all that I have shared with you, I hope to be able to give you a reference, and I hope that you support me more.
Related articles
Example of a python script that executes a CMD command and returns the result
Today I'm going to share with you an example of a python script that executes a CMD command and returns the result, with good reference value, I hope it will help you. Together follow the editor over to see it2019-08-08python in the json format data output simple implementation method
The following editor will bring you a python in json format data output simple implementation method. I think it is quite good, now share it with you, but also give you a reference. Together follow the editor over to see it2016-10-10Detailed procedure for adding command line arguments to python
Click is Flask's development team Pallets another open source project, it is used to quickly create the command line of the third-party module, this article mainly introduces how to add command line parameters python, if you need friends can refer to the following2023-06-06Python connects to HDFS to realize file upload and download and Pandas to convert text files to CSV operations
This article introduces the Python connection to HDFS to achieve file upload and download and Pandas conversion of text files to CSV operation, with good reference value, I hope to help you. Follow the editor over to see it together2020-06-06Ways to accelerate Python operations with numba
Today I'm going to share with you a way to use numba to Python arithmetic acceleration, with good reference value, I hope to help you. Together follow the editor over to see it2018-10-10Python3 implementation of the dictionary traversal operations in detail
This article introduces the Python3 implementation of the dictionary traversal operation, combined with an example of the form analyzes the Python3 for the dictionary keys, keys and key-value and key-value pairs of traversal of the relevant operation techniques, you need to refer to the friends can refer to the following2018-04-04Detailed procedure for configuring graphviz package in anaconda
graphviz is an open source toolkit developed by Bell Labs , it uses a specific DSL (Domain Specific Language): dot as the scripting language , and then use the layout engine to parse this script , and complete the automatic layout , this article mainly introduces how to configure the graphviz package in anaconda , if you need it you can refer to the following2023-02-02Graphic tutorial for configuring PySide2 in PyCharm
This article introduces the PyCharm configuration PySide2 tutorial, this article through the illustrated form to give you a very detailed, for everyone to learn or work with a certain reference value, the need for friends can refer to the next!2020-06-06Empty value judgment and empty string judgment methods in python
This article introduces the python judgment of the null value and the empty string judgment, with good reference value, I hope to help you, if there is an error or not fully considered place, look no advice!2023-11-11Python Shares 10 PyCharm Tips
This article introduces Python share 10 PyCharm skills, today we want to share with you a few PyCharm tips to help you improve efficiency! The following is a list of some of the PyCharm tips that you can share with your friends.2019-07-07