0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Twitchスタンプ用の画像をリサイズするコード

Posted at

#概要
Twitchでスタンプを作成する時、
画像をリサイズする作業が手間なので、
簡単にリサイズできるコードを考えました。

#使い方
pythonスクリプトへ画像をドラッグアンドドロップすることで、
スクリプトの保存されているフォルダに、リサイズされた画像が保存されます。

#ソース

twitch_resize.py
import sys
from PIL import Image

#ドラッグされたファイルのパスを開く
fp = sys.argv[1]
img = Image.open(fp)

#リサイズ用関数
def resize_save(img,size):
    img = img.resize((size, size))
    img.save(str(size) + ".png")

#サイズを28,56,112に変更する
resize_save(img,28)
resize_save(img,56)
resize_save(img,112)
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?