LoginSignup
2
3

More than 5 years have passed since last update.

めざせpythonライブラリマスター (1)da-vinci

Posted at

【ライブラリ説明】

 画像をいじるためのライブラリ

【準備】

 da-vinciを使用するにはPillowも必要

【プログラム】

da-vinci.py
# -*- coding: utf-8 -*-

from da_vinci import Image

# URLを使用して画像取ってくる
image = Image('http://stamps.co.id/static/merchants/img/logo.png')
# 画像を左右逆にする
image.flip('horizontal')
# 画像サイズ変更
image.resize(width=120, height=120)
# 拡張子pngで保存
# qualityは百分率で設定するようだが、値を変えて何が変化するのか分からない
image.set(format='png', quality=85)
# 画像保存
image.save()

【結果】

 logo.png

【感想】

 URLで画像を指定できるのがいいね!

【参考サイト】

 da-vinci
 github

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3