Telegram Group & Telegram Channel
Работаем с картинками в Python

Библиотека Pillow — это очень мощный, быстрый и удобный инструмент для обработки графики в Python.

В сегодняшнем примере мы применим ее для конвертации картинки в черно-белую, обратим цвета, вертикально отзеркалим и сохраним в файл.

Метод Image.open('resources/img/cat.jpg') считывает картинку из папки.

img.convert('L') трансформирует картинку в черно-белую.

ImageOps.invert(image) обращает цвета.

img.transpose(Image.FLIP_LEFT_RIGHT) вертикально отзеркаливает картинку.

img.save('grayscale_cat.jpg') сохранит картинку на диске.

Больше официальных примеров и документацию можно посмотреть тут.

Пример можно посмотреть тут.

#pillow



tg-me.com/python_academy/1998
Create:
Last Update:

Работаем с картинками в Python

Библиотека Pillow — это очень мощный, быстрый и удобный инструмент для обработки графики в Python.

В сегодняшнем примере мы применим ее для конвертации картинки в черно-белую, обратим цвета, вертикально отзеркалим и сохраним в файл.

Метод Image.open('resources/img/cat.jpg') считывает картинку из папки.

img.convert('L') трансформирует картинку в черно-белую.

ImageOps.invert(image) обращает цвета.

img.transpose(Image.FLIP_LEFT_RIGHT) вертикально отзеркаливает картинку.

img.save('grayscale_cat.jpg') сохранит картинку на диске.

Больше официальных примеров и документацию можно посмотреть тут.

Пример можно посмотреть тут.

#pillow

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/1998

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Tata Power whose core business is to generate, transmit and distribute electricity has made no money to investors in the last one decade. That is a big blunder considering it is one of the largest power generation companies in the country. One of the reasons is the company's huge debt levels which stood at ₹43,559 crore at the end of March 2021 compared to the company’s market capitalisation of ₹44,447 crore.

To pay the bills, Mr. Durov is issuing investors $1 billion to $1.5 billion of company debt, with the promise of discounted equity if the company eventually goes public, the people briefed on the plans said. He has also announced plans to start selling ads in public Telegram channels as soon as later this year, as well as offering other premium services for businesses and users.

Python Academy from us


Telegram Python Academy
FROM USA