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'

Metadata

Release files for ptu 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 ptu 0.3.0
File Size Uploaded Provenance Actions
ptu-0.3.0.tar.gz 7.3 kB Without provenance Details for ptu-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 19.2 kB

Release files / ptu-0.3.0.tar.gz

Download URL ptu-0.3.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1c261ee8ab0776fc1e58ef1a5bcbe1b924fb71273ca2ad2da6844cfe4432ace8
BLAKE2b-256 checksum
How to use checksums
9b0e1d50b7122995d8860db1e13aed910f9d21b434b66969a74382278a825bf3
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.6.0

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

Download URL ptu-0.3.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9cf7ef2bf4a47448460792345e48a912b37ff468223e15d8e8673575397d7168
BLAKE2b-256 checksum
How to use checksums
3ab6428139d0165985f46a5cfd616e051c6081f5408d7a38aa79dbff0cb18d1e
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.6.0

Security for ptu 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

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