Skip to content

BerBai/WMK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watermark Script

中文文档 | README in English

Add text watermark to images with options for watermark size, color, rotation, spacing, and transparency.

Usage

Install the PIL library:

pip install Pillow

Parameter explanation:

usage: marker.py [-h] [-f FILE] [-m MARK] [-o OUT] [-c COLOR] [-s SPACE] [-a ANGLE] [--font-family FONT_FAMILY] [--font-height-crop FONT_HEIGHT_CROP] [--size SIZE]
                 [--opacity OPACITY] [--quality QUALITY]

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  image file path or directory
  -m MARK, --mark MARK  watermark content
  -o OUT, --out OUT     image output directory, default is ./output
  -c COLOR, --color COLOR
                        text color like '#000000', default is #8B8B1B
  -s SPACE, --space SPACE
                        space between watermarks, default is 75
  -a ANGLE, --angle ANGLE
                        rotate angle of watermarks, default is 30
  --font-family FONT_FAMILY
                        font family of text, default is './font/庞门正道标题体免费版.ttf'
                        using font in the system just by font file name
                        for example 'PingFang.ttc', which is default installed on macOS
  --font-height-crop FONT_HEIGHT_CROP
                        change watermark font height crop
                        float will be parsed to factor; int will be parsed to value
                        default is '1.2', meaning 1.2 times font size
                        this is useful with CJK font because line height may be higher than size
  --size SIZE           font size of text, default is 50
  --opacity OPACITY     opacity of watermarks, default is 0.15
  --quality QUALITY     quality of output images, default is 90

Example

python marker.py -f ./example/test.png -m WMK水印

compress PDF Script

Simple python wrapper script to use ghoscript function to compress PDF files.

Compression levels: 0: default 1: prepress 2: printer 3: ebook 4: screen

Usage

Install the Ghostscript:

On MacOSX install via command line:

brew install ghostscript

Parameter explanation:

usage: pdfc.py [-h] [-f FILE] [-r ROUTE]

Simple python wrapper script to use ghoscript function to compress PDF files.

Compression levels:
    0: default
    1: prepress
    2: printer
    3: ebook
    4: screen

Dependency: Ghostscript.
On MacOSX install via command line `brew install ghostscript`.

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  Relative or absolute path of the input PDF file name
  -r ROUTE, --route ROUTE
                        Relative or absolute path PDF folder

License

The GPL-2.0 license.

About

Adding watermarks to images

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages