#color #image #colored-text #text

image_colored_text

A basic extension of the image/imageproc crates for writing multiline colored text

3 releases

0.1.2 Apr 16, 2023
0.1.1 Mar 25, 2023
0.1.0 Mar 20, 2023

#722 in Images


Used in scpcb_redux_mapper

Apache-2.0

235KB
326 lines

A basic extension of the image/imageproc crates for writing multiline colored text

I initially wrote this code for this project: hibou.

Since then it has evolved a bit and I decided to repackage it on its own as a library.

Single line colored text

In the example below some colored text is written on a single line at different positions. In each of the three example, the little cross corresponds to the anchor position on which the text is written, with different options on how to use this position:

  • in the first example the text is written below and on the right of the anchor
  • in the second the text is centered around the anchor
  • in the third example, it is written above and on the left

The horizontal lines correspond to the expected width of the text.

drawing single line colored text

Multiline colored text

In the example below we have a similar example except that the input text is formatted in several lines. We also provide a means to specify the text alignment which is:

  • on the left for the first example
  • centered for the second
  • on the right for the third
drawing single line colored text

Dependencies

~21MB
~222K SLoC