massao000 / aspect_ratio

アスペクト比を計算するライブラリ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

アスペクト比計算

インストール

pip install git+https://github.com/massao000/aspect_ratio

使い方

import aspect_ratio

aspect = aspect_ratio.Aspect()

# 全ての比率を取得する
aspect.all()

# 格納された標準アスペクト比
print(aspect.result_dict)

# 8で割り切れるアスペクト比
print(aspect.result_divisible8)
  • aspect.aspect_sizeからアスペクト比の一覧
aspect_size = aspect.aspect_size['hi_vision_ratio']

print(aspect.result_divisible8[aspect_size]['width'])
print(aspect.result_divisible8[aspect_size]['height'])

関数

# 全ての比率を取得する
aspect.all()

# 長方形(横長)
aspect.w2hAll()

# 長方形(縦長)
aspect.t2wAll()

アスペクト比表

argument aspect ratio img
without_change without_change width,height指定で任意のサイズ
square 1:1
hi_vision_ratio 16:9
camera_ratio 3:2
academy_ratio 4:3
scope_ratio 2:1
golden_ratio 1:1.618
silver_ratio 1:1.414
swap_hi_vision_ratio 9:16
swap_camera_ratio 2:3
swap_academy_ratio 3:4
swap_scope_ratio 1:2
swap_golden_ratio 1.618:1
swap_silver_ratio 1.414:1

About

アスペクト比を計算するライブラリ


Languages

Language:Python 100.0%