一个简单的图像操作库,旨在使常见的图像任务变得容易。
da-vinci的Python项目详细描述
一个简单的图像处理库,用于生成普通的图像/照片 操作任务简单。这个图书馆还在开发中, API也可以随时更改
需要软毛/枕头。
示例用法:
from da_vinci import Image image = Image('lena.jpg') image.flip('horizontal') image.resize(width=10, height=10) image.save() # Opening an image from URL, rotating and change it's format image = Image('http://stamps.co.id/static/merchants/img/logo.png') image.rotate(degrees=90) image.set(format='jpg', quality=85) image.save() # Creates a file logo.jpg # Manipulating saturation, brightness, contrast and sharpness # Accepts values range from -100 (decrease) to 100 (increase) image.adjust(saturation=-100) image.adjust(brightness=-75, contrast=50, sharpness=-20)
如果你需要更广泛的操作,一个逃生舱 还提供:
image = image.from_file('a.jpg') pil_image = image.get_pil_image() # Do whatever you need to do with the pil image # And if you want to convert this back to a da_vinci image image.set_pil_image(pil_image)
测试
运行测试:
python -m unittest tests
变更日志
版本0.2.2
- 添加了BMP扩展支持