python で画像をリサイズする方法のメモ。
import sys from PIL import Image def main(): in_file = sys.argv[1] out_file = sys.argv[2] rate = float(sys.argv[3]) img = Image.open(in_file) out_width = int(img.width * rate) out_height = int(img.height * rate) out_img = img.resize((out_width, out_height)) out_img.save(out_file) return 0 exit(main())