Skip to content

ryamashina/drawtext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drawtext

JPEG形式の画像に指定したテキスト印字します。

Print the specified text on the JPEG image.

Caution
JPEG形式の画像のみ処理可能です。
Caution
Only JPEG images can be processed.
Caution
Ubuntu18.04で動作確認しています。

1. Licence

This software is released under the MIT License, see LICENSE.txt.

1.1. 同梱フォント : Include Fonts

印字するデフォルトのフォントとして下記を同梱しています。

The following fonts are included in the package as default fonts for printing.

1.2. 同梱画像 : Include image

印字テスト用の画像として下記を同梱しています。

The following images are included for printing tests.

Anne KroißによるPixabayからの画像

2. Example

Terminal
drawtext test.jpg $'印字例\nテキストを印字'
出力画像
Figure 1. 出力画像: test_drawtext.jpg

3. Install

Terminal
git clone https://github.com/ryamashina/drawtext.git
pip3 install drawtext/dist/drawtext-0.0.1.tar.gz

4. Run

Terminal
~/.local/bin/drawtext test.jpg $'印字例\nテキストを印字'
Caution
Change your PATH for installed drawtext command.

5. Usage

drawtext -h
usage: drawtext [-h] [-of OUTPUT_FILE] [-ff FONT_FILE] [-fs FONT_SIZE]
                [-sw STROKE_WIDTH] [-sp SPACING] [-al ALIGN] [-fc FONT_COLOR]
                [-sc STROKE_COLOR] [-rc RECT_COLOR]
                input_image_file text

Draw text on JPEG.

positional arguments:
  input_image_file      File name of input image. The image must be in JPEG
                        format.
  text                  Text for insert to image.

optional arguments:
  -h, --help            show this help message and exit
  -of OUTPUT_FILE, --output_file OUTPUT_FILE
                        Output image file name. default is
                        "${input_image_file}_drawtext.jpg".
  -ff FONT_FILE, --font_file FONT_FILE
                        Font file name for text. default is "NotoSerifCJKjp-
                        Black.otf".
  -fs FONT_SIZE, --font_size FONT_SIZE
                        Font size for text. default is 50.
  -sw STROKE_WIDTH, --stroke_width STROKE_WIDTH
                        Stroke width for text. default is 3.
  -sp SPACING, --spacing SPACING
                        Spacing for text line. default is 0.
  -al ALIGN, --align ALIGN
                        Align for text. default is "center".
  -fc FONT_COLOR, --font_color FONT_COLOR
                        Font color for text. default is "#FFFF00".
  -sc STROKE_COLOR, --stroke_color STROKE_COLOR
                        Stroke color for text. default is "#000000".
  -rc RECT_COLOR, --rect_color RECT_COLOR
                        Rect color for background of font. default is
                        "#FFFFFF80".

About

Print the specified text on the JPEG image.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages