๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Python/Basic

[Python] Pillow ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ ํ™•์ธ

๋ฐ˜์‘ํ˜•

 

 

https://note.nkmk.me/en/python-opencv-pillow-image-size/

 

Get image size (width, height) with Python, OpenCV, Pillow (PIL) | note.nkmk.me

This article describes how to get the image size (width, height) in Python with OpenCV and Pillow (PIL).The image size can be obtained as a tuple with the attribute shape of ndarray in OpenCV and the attribute size of PIL.Image in Pillow (PIL). Note that t

note.nkmk.me

 

from PIL import Image

im = Image.open('data/src/lena.jpg')

print(im.size)
print(type(im.size))
# (400, 225)
# <class 'tuple'>

w, h = im.size
print('width: ', w)
print('height:', h)
# width:  400
# height: 225
๋ฐ˜์‘ํ˜•

'Python > Basic' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Python] curve fitting  (1) 2022.09.30
[Python] PDF ๊ด€๋ จ ํŒจํ‚ค์ง€ ์ •๋ฆฌ  (0) 2022.08.05
[Python] ํŒŒ์ผ ๊ด€๋ จ  (0) 2022.07.19
[Python] Excel, Word ๋‹ค๋ฃจ๊ธฐ  (0) 2021.07.26
[Python] XlsxWriter - Excel ๋‹ค๋ฃจ๊ธฐ  (0) 2021.07.26