Python pillow库 (滤镜)
2017-09-30 本文已影响0人
章鱼杂咀
```python
from PIL import Image
im = Image.open('1x.png')
r,g,b = im.split()
om = Image.merge('RGB',(b,g,r))
om.save('1x-bgr.png')
om = Image.merge('RGB',(r,b,g))
om.save('1x-rbg.png')
```
```python
from PIL import Image
from PIL import ImageEnhance
im = Image.open('1x.png')
om = ImageEnhance.Contrast(im)
om.enhance(20).save('enhance3.png')
```
```python
from PIL import Image
from PIL import ImageEnhance
im = Image.open('1x.png')
om = ImageEnhance.Contrast(im)
om.enhance(20).save('enhance3.png')
```
```python
from PIL import Image
from PIL import ImageFilter
im = Image.open('1x.png')
om = im.filter(ImageFilter.CONTOUR)
om.save('1x-.png')
```