Skip to main content

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'

Release files for pitu 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pitu 0.3.0
File Size Uploaded
pitu-0.3.0.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pitu 0.3.0
File Interpreter ABI Platform
pitu-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.6 kB

Release files / pitu-0.3.0.tar.gz

Download URL pitu-0.3.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6fe9713ceab12c7bb36d46637aef8c02cf5ece704d53c9c7844fc767b84c2bf7
BLAKE2b-256 checksum
How to use checksums
4fb2c5c9049ab601a52ac8c08f01d7a01ddc6055ec0029581d7ca743366625bc
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / pitu-0.3.0-py3-none-any.whl

Download URL pitu-0.3.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
908800ac00a2424b1b5d2227689784acc1483f16d99c6aa6fece96ece3baeff0
BLAKE2b-256 checksum
How to use checksums
627bdbacdb3f1eea71c2e1fe9ea219189ce4598ce26310bc45c1b334ec6dcde0
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page