How to open pictures with zero basic knowledge of python

步履不停
Release: 2019-07-29 09:26:04
Original
4514 people have browsed it

How to open pictures with zero basic knowledge of python

Introduces the process of opening images in python.

Tools/Materials

python3.6

pycharm

Methods/Steps

First, import the PIL module.

How to open pictures with zero basic knowledge of python

Then, save a path variable of the image. In this example, the image is in the directory where the py file is located, so when using a relative path, just use the image name.

How to open pictures with zero basic knowledge of python

# Open the image through the image path image = Image.open(path)

How to open pictures with zero basic knowledge of python

# Print the image information print( image.size, image.format)

How to open pictures with zero basic knowledge of python

Set size image.thumbnail((100, 200))

How to open pictures with zero basic knowledge of python

# Save image.save('3.jpg')

How to open pictures with zero basic knowledge of python

END

Notes

Also You can download the third-party module pillow to process images conveniently and quickly

Recommended related tutorials:Python video tutorial

The above is the detailed content of How to open pictures with zero basic knowledge of python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!