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

pitu-0.3.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pitu-0.3.0.tar.gz
  • Upload date:
  • Size: 8.7 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.7.4

File hashes

Hashes for pitu-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6fe9713ceab12c7bb36d46637aef8c02cf5ece704d53c9c7844fc767b84c2bf7
MD5 af4d11265c6743ad43a00946a3e1a749
BLAKE2b-256 4fb2c5c9049ab601a52ac8c08f01d7a01ddc6055ec0029581d7ca743366625bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pitu-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.7.4

File hashes

Hashes for pitu-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 908800ac00a2424b1b5d2227689784acc1483f16d99c6aa6fece96ece3baeff0
MD5 583b2109cccea5e2ec3ebadcc1941a9e
BLAKE2b-256 627bdbacdb3f1eea71c2e1fe9ea219189ce4598ce26310bc45c1b334ec6dcde0

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