#generate #image #text #xǐbào #congratulations #xibao #喜报

bin+lib xibao-gen

Generate Xǐbào(喜报, CONGRATULATIONS) image

1 unstable release

new 0.1.0 Dec 9, 2024

#184 in #text

MIT license

2.5MB
430 lines

Xǐbào Generator

Generates a picture with a title of Xǐbào (CONGRATULATIONS) and given text in the middle.

Very early stage.

Sample result: Xǐbào: My xǐbào generator now works

Build dependencies

  • A C/C++ toolchain.
  • SDL2 available in pkg-config, run pkg-config --cflags sdl2 to confirm.
  • SDL2_image available in pkg-config, run pkg-config --cflags SDL2_image to confirm.

Non-Rust dependencies

This project depends on the following non-rust libraries.

  • LibC (of course)
  • C++ standard library (for Skia)
  • SDL2
  • SDL2_image
  • Skia
  • Any library that the libraries above depend on

How to use the tool (some examples)

Assuming the tool's binary is called xibao-gen.

To generate a Xǐbào with given text, use

xibao-gen "Your text here"

or

xibao-gen --text "Your text here"

If the given text is in a file, then use -i or --from-file to specify the path of the file.

xibao-gen -i path/to/your/file

instead.

The output image will usually named output.png in the current directory. If you want to specify output image's path, you can use -o or --to-file.

xibao-gen -o path/to/output.png -i path/to/your/file

Notice that .png will be added automatically if you don't.

To adjust size of the image, use --size or for short -s. (Default size is 48)

xibao-gen -s 64 Hello_World

Combine them together, here is an example for generating a Xǐbào picture, which the content is from file xibao_content.txt, and outputs to result.png, using font size of 64:

xibao-gen -i xibao_content.txt -o result.png -s 64

For further help, use

xibao-gen --help

Dependencies

~21MB
~443K SLoC