1. Install

PIP install pitu = = 0.3.0Copy the code

2. P single figure

Single image processing is divided into: zoom (zoom), rotate (rotate), mirror (flip), cut (cut), gray (gray), add text (text).

Command line format: Pintu Command image parameter.

2.1 zoom

Pitu zoom < Image path > < Zoom Scale > [width [height]]

Pitu zoom 1.jpeg 0.5 PITu zoom 1.jpeg 0 200 pitu zoom 1.jpeg 00 200Copy the code

2.2 rotate

Pitu rotate < Image path > < Angle > [Fill color]

pitu rotate 2.jpeg 45
pitu rotate 2.jpeg 45 '#f2de98'
Copy the code

2.3 mirror

Pitu flip the image path > < x: horizontal | y: vertical >

pitu flip 3.jpeg x
pitu flip 4.jpeg y
Copy the code

2.4 cutting

Pitu cut < image path > < left distance > < top distance > < clipping width > < clipping height >

pitu cut 5.jpeg 50 0 500 500
Copy the code

2.5 gray

Pitu Gray < Image path >

pitu gray 6.jpeg
Copy the code

2.6 Adding Text

Pitu text < image path > <” text “> [left distance [top distance [font width [font color]]]]

pitu text 7.jpeg 'Hello, I'm Liu X Fei! '
pitu text 7.jpeg 'Hello, I'm Liu X Fei! ' 20 20
pitu text 7.jpeg 'Hello, I'm Liu X Fei! ' 20 20 30
pitu text 7.jpeg 'Hello, I'm Liu X Fei! ' 20 20 30 '#d99bb0'
Copy the code

2.7 Shortcut Functions

2.7.1 Making an avatar

Pitu Avatar < picture path > [ex: Background Extension]

pitu avatar 8.jpeg
pitu avatar 9.jpeg ex
Copy the code

2.2.2 Making cover

Pitu cover images < path > [ce: center cutting | ex: background expand] [aspect ratio]

Make wechat graphic cover, width to height ratio: 2.35.

Pitu Cover 10. Jpeg CE 2.35Copy the code

Custom aspect ratio.

pitu cover 11.jpeg ce '4:3'
pitu cover 12.jpeg ex '16:9'
Copy the code

3. Pin photos

3.1 landscape

Pitu Pin y < picture 1 Picture 2 picture 3… The picture n >

pitu pin y 13.jpeg 14.jpeg 15.jpeg
Copy the code

3.2 the horizontally

Pitu pin x < picture 1 Picture 2 picture 3… The picture n >

pitu pin x 14.jpeg 15.jpeg 16.jpeg
Copy the code

4. Scratchable latex

4.1 compact

Pitu Grid < picture 1 picture 2… Image 9 >

pitu grid 1.jpeg 2.jpeg 3.jpeg 4.jpeg 5.jpeg 6.jpeg 7.jpeg 8.jpeg 9.jpeg
Copy the code

4.2 Maintaining Spacing

Pitu Grid < picture 1 picture 2… Image 9> ‘:gap= spacing ‘

pitu grid 1.jpeg 2.jpeg 3.jpeg 4.jpeg 5.jpeg 6.jpeg 7.jpeg 8.jpeg 9.jpeg ':gap=3'
Copy the code

4.3 Resize

Pitu Grid < picture 1 picture 2… Image 9> ‘:width= width :height= height ‘

pitu grid 1.jpeg 2.jpeg 3.jpeg 4.jpeg 5.jpeg 6.jpeg 7.jpeg 8.jpeg 9.jpeg \
          ':width=600 :height=600 :gap=3'
Copy the code

4.4 Customizing Columns and Columns

Pitu Grid < picture 1 picture 2… ‘:rows= cols= cols’

pitu grid 1.jpeg 2.jpeg 3.jpeg 4.jpeg \
          5.jpeg 6.jpeg 7.jpeg 8.jpeg \
          9.jpeg 10.jpeg 11.jpeg 12.jpeg \
          13.jpeg 14.jpeg 15.jpeg 16.jpeg \
          ':rows=4 :cols=4 :width=940 :height=400 :gap=3'
Copy the code

5. The batch P

If you think that a single P diagram is too tedious, you can edit multiple P diagram instructions in notepad at a time, each instruction occupies a line, and save the file named pitu.txt. The instruction is formatted the same as the single execution, with the only difference being that the first word pitu is removed.

The following is an example of the contents of the pitu.txt file:

zoom 1.jpeg 0 0 200
rotate 2.jpeg 45 '#f2de98'
flip 3.jpeg x
flip 4.jpeg y
cut 5.jpeg 50 0 500 500
gray 6.jpeg
text 7.jpeg 'Hello, I'm Liu X Fei! ' 20 20 30 '#d99bb0'Jpeg EX cover 10. Jpeg CE 2.35 cover 11'16:9'
pin x 12.jpeg 13.jpeg 14.jpeg
pin y 14.jpeg 15.jpeg 16.jpeg
grid 1.jpeg 2.jpeg 3.jpeg 4.jpeg 5.jpeg 6.jpeg':rows=2 :cols=3 :width=940 :height=400 :gap=3'
Copy the code

Run the following command in the directory where the pitu. TXT file is stored to run all p-graph commands in batches.

pitu -f
Copy the code

github

Github.com/kenblikylee…



This article was first published with a public number