A library to easily create text-based images (e.g. images that primarily contain text).
Project description
TxtImg
A library to easily create text-based images (e.g. images that primarily contain text).
This is just a thin layer on top of Pillow.
Installation
This is compatible with Python 3.6 and above.
Run the following command to install:
$ pip install txtimg
Example
from txtimg import TxtImg
text = """
What did Sushi A say to Sushi B?
What's up B? (WASABI)
"""
t = TxtImg()
img = t.generate_from_text(text)
img.save("wasabi.png")
Configuration
You can specify parameters to the TxtImg constructor:
- font - Font used for your text. This is a PIL ImageFont object
- base_img - You can specify a base image to use, rather than the default white background. This is a PIL Image object.
- horizontal_margin - Horizontal margin in pixels
- vertical_margin - Vertical margin in pixels
- chars_per_row - Number of characters per row
- txt_color - A tuple representing the RGB values, e.g. (255, 0, 0) for red.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file txtimg-0.0.9.tar.gz.
File metadata
- Download URL: txtimg-0.0.9.tar.gz
- Upload date:
- Size: 94.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e1e4236d9918423c6c2c43d4b2e5da37fb052d4cf3b69bdfd296412611b15ab
|
|
| MD5 |
df96e1e9010bbf811d370cc976020448
|
|
| BLAKE2b-256 |
2897956dd3a392cd89b4c2e39a3102b50481c8745a61117303be048e3342dd98
|
File details
Details for the file txtimg-0.0.9-py3-none-any.whl.
File metadata
- Download URL: txtimg-0.0.9-py3-none-any.whl
- Upload date:
- Size: 94.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af1fae3a1719435a55922c7a79fbcfce34e64ac9a8c1b63a7ae8364978d993c6
|
|
| MD5 |
8fc097a7197967fcd534b8ff673a5d07
|
|
| BLAKE2b-256 |
ff7a2014dda8b58ad66125a2fa106bf8cfb61144025138e2f1ba8da33bfc1279
|