Skip to main content

python 开源命令行P图工具。

Project description

pitu

python 开源命令行P图工具。

安装

pip install pitu

命令行使用方式

缩放 zoom

pitu zoom <photo_path> [width [height]]

pitu zoom photo.jpg 0.5
pitu zoom photo.jpg 0 600
pitu zoom photo.jpg 0 0 300

旋转 rotate

pitu rotate <photo_path> [color]

pitu rotate photo.jpg 45
pitu rotate photo.jpg 45 green
pitu rotate photo.jpg 45 '#ff0000'

翻转(镜像) flip

pitu flip <photo_path> <x|y>

pitu flip photo.jpg x
pitu flip photo.jpg y

裁剪 cut

pitu cut <photo_path> <x> <y> <width> <height>

pitu cut photo.jpg 100 100 200 200

灰度 gray

pitu gray <photo_path>

pitu gray photo.jpg

文本 text

pitu text <photo_path> <text> [x [y [font_size [color [pf|yh]]]]]

pitu text photo.jpg '我的P图工具'
pitu text photo.jpg '我的P图工具' 300 100
pitu text photo.jpg '我的P图工具' 300 100 50
pitu text photo.jpg '我的P图工具' 300 100 50 '#f0f'
pitu text photo.jpg '我的P图工具' 300 100 50 blue pf
pitu text photo.jpg '我的P图工具' 300 100 50 cyan yh

拼图 pin

pitu pin <x|y> <photo1_path photo2_path [photo3_path ... photon_path]> [diff]

pitu pin x zoom-photo.jpg rotate-photo.jpg flip-photo.jpg cut-photo.jpg gray-photo.jpg  text-photo.jpg
pitu pin y zoom-photo.jpg rotate-photo.jpg flip-photo.jpg cut-photo.jpg gray-photo.jpg  text-photo.jpg

pitu pin x zoom-photo.jpg rotate-photo.jpg flip-photo.jpg cut-photo.jpg gray-photo.jpg  text-photo.jpg diff
pitu pin y zoom-photo.jpg rotate-photo.jpg flip-photo.jpg cut-photo.jpg gray-photo.jpg  text-photo.jpg diff

头像 avatar

pitu avatar <photo_path> [mode]

pitu avatar photo.jpg
pitu avatar photo.jpg ex

封面 cover

pitu cover <photo_path> [mode [ratio]]

pitu cover photo.jpg
pitu cover photo.jpg ex
pitu cover photo.jpg ce 2.35
pitu cover photo.jpg ex '16:9'

9宫格和任意网格 grid

pitu grid <photo1_path photo2_path [photo3_path ... photon_path]> \
[':rows=行数 :cols=列数 :width=宽 :height=高 :gap=间距 :padding=边距 :color=背景色']

pitu grid 1.jpg 2.jpg 3.jpg 4.jpg 5.jpg 6.jpg 7.jpg 8.jpg 9.jpg

pitu grid 1.jpg 2.jpg 3.jpg 4.jpg ':rows=2 :cols=2 :width=600 :height=300 :gap=10 :padding=20 :color=#555'

编程:批量执行多个P图命令

  • pitu -f
  • pitu -f <program_file>

省略 program_file 参数,默认执行文件 pitu.txt 中的P图命令, 如果执行其他文件,必须显式提供该参数。

pitu -f
pitu -f other_pitu.txt

content of file pitu.txt :

zoom 1.jpg 0 0 300
rotate 2.jpg 45 #ff0000
flip 3.jpg y
cut 4.jpg 100 120 200 220
gray 5.jpg
text 6.jpg "hello world!" 300 100 50 #f00
pin x 7.jpg 8.jpg 9.jpg 10.jpg
pin y 7.jpg 8.jpg 9.jpg 10.jpg
avatar 11.jpg
avatar 11.jpg ex
cover 12.jpg ce 2.35
cover 12.jpg ex 16:9

text 1.jpeg "你好! 我是 Python P图工具,我的英文名叫 pitu !" 10 10 50 #f00
grid 1.jpeg 2.jpeg 3.jpeg 4.jpeg 5.jpeg 6.jpeg 7.jpeg 8.jpeg 9.jpeg ':rows=2 :cols=4 :width=940 :height=400 :gap=5 :padding=0 :color=#eee'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ptu-0.3.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

ptu-0.3.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file ptu-0.3.0.tar.gz.

File metadata

  • Download URL: ptu-0.3.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.0

File hashes

Hashes for ptu-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1c261ee8ab0776fc1e58ef1a5bcbe1b924fb71273ca2ad2da6844cfe4432ace8
MD5 ab3ec61265af4bd0d749133fa4bff4e1
BLAKE2b-256 9b0e1d50b7122995d8860db1e13aed910f9d21b434b66969a74382278a825bf3

See more details on using hashes here.

File details

Details for the file ptu-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ptu-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.0

File hashes

Hashes for ptu-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9cf7ef2bf4a47448460792345e48a912b37ff468223e15d8e8673575397d7168
MD5 f4c910d7cd87f2896b4b8e60163e07f2
BLAKE2b-256 3ab6428139d0165985f46a5cfd616e051c6081f5408d7a38aa79dbff0cb18d1e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page