Skip to content

Commit fe641ca

Browse files
committed
rotate_scale
1 parent c9890d9 commit fe641ca

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4265,8 +4265,45 @@ division by zero
42654265

42664266
完整的输出信息如下图片所示:
42674267

4268+
4269+
42684270
![image-20200104103849047](./img/image-20200104103849047.png)
42694271

4272+
#### 2 两行代码实现旋转和缩放图像
4273+
4274+
首先安装pillow:
4275+
4276+
```python
4277+
pip install pillow
4278+
```
4279+
4280+
旋转图像下面图像45度:
4281+
4282+
![](./img/plotly2.png)
4283+
4284+
```python
4285+
In [1]: from PIL import Image
4286+
In [2]: im = Image.open('./img/plotly2.png')
4287+
In [4]: im.rotate(45).show()
4288+
```
4289+
4290+
旋转45度后的效果图
4291+
4292+
![image-20200105085120611](./img/image-20200105085120611.png)
4293+
4294+
等比例缩放图像:
4295+
4296+
```python
4297+
im.thumbnail((128,72),Image.ANTIALIAS)
4298+
```
4299+
4300+
缩放后的效果图:
4301+
4302+
![](./img/pillow_suofang.png)
4303+
4304+
4305+
4306+
42704307
### 九、Python实战
42714308

42724309

img/image-20200105085120611.png

102 KB
Loading

img/pillow_suofang.png

9.29 KB
Loading

0 commit comments

Comments
 (0)