PIL은 Python 인터프리터에 이미지 편집 기능을 제공하는 Python 이미징 라이브러리입니다. 이미지 모듈은 PIL 이미지를 나타내는 데 사용되는 동일한 이름의 클래스를 제공합니다. 또한 이 모듈은 파일에서 이미지를 로드하고 새 이미지를 생성하는 기능을 포함하여 다양한 팩토리 기능을 제공합니다.
이미지.크기 조정() 이 이미지의 크기가 조정된 복사본을 반환합니다.
통사론: Image.resize(크기, 재샘플=0)
매개변수 :
크기 – 요청된 크기(픽셀), 2-튜플: (너비, 높이).
다시 샘플링하다 – 선택적 리샘플링 필터. PIL.Image.NEAREST(가장 가까운 이웃 사용), PIL.Image.BILINEAR(선형 보간), PIL.Image.BICUBIC(3차 스플라인 보간) 또는 PIL.Image.LANCZOS(고품질 다운샘플링 필터) 중 하나일 수 있습니다. ). 생략하거나 이미지에 모드 1 또는 P가 있는 경우 PIL.Image.NEAREST로 설정됩니다. 그렇지 않은 경우 기본 필터는 Resampling.BICUBIC입니다.
반품 유형 : 이미지 객체입니다.
사용된 이미지:

파이썬3
자바가 아닌 무작위
아리안 칸
# Importing Image class from PIL module> from> PIL>import> Image> # Opens a image in RGB mode> im>=> Image.>open>(r>'C:UsersSystem-PcDesktopybear.webp'>)> # Size of the image in pixels (size of original image)> # (This is not mandatory)> width, height>=> im.size> # Setting the points for cropped image> left>=> 4> top>=> height>/> 5> right>=> 154> bottom>=> 3> *> height>/> 5> # Cropped image of above dimension> # (It will not change original image)> im1>=> im.crop((left, top, right, bottom))> newsize>=> (>300>,>300>)> im1>=> im1.resize(newsize)> # Shows the image in image viewer> im1.show()> |
>
자바 케이스 진술
>
산출:

다른 예시: 여기서는 다른 newsize 값을 사용합니다.
C++의 xor
파이썬3
# Importing Image class from PIL module> from> PIL>import> Image> # Opens a image in RGB mode> im>=> Image.>open>(r>'C:UsersSystem-PcDesktopybear.webp'>)> # Size of the image in pixels (size of original image)> # (This is not mandatory)> width, height>=> im.size> # Setting the points for cropped image> left>=> 6> top>=> height>/> 4> right>=> 174> bottom>=> 3> *> height>/> 4> # Cropped image of above dimension> # (It will not change original image)> im1>=> im.crop((left, top, right, bottom))> newsize>=> (>200>,>200>)> im1>=> im1.resize(newsize)> # Shows the image in image viewer> im1.show()> |
>
자바 스윙
>
산출:
