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
txtimg-0.0.8.tar.gz
(94.4 kB
view details)
Built Distribution
txtimg-0.0.8-py3-none-any.whl
(94.1 kB
view details)
File details
Details for the file txtimg-0.0.8.tar.gz
.
File metadata
- Download URL: txtimg-0.0.8.tar.gz
- Upload date:
- Size: 94.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93e599b07d216ca05e4240ab5e21204387673680120e2fd5ad2eaed00d30d2ad |
|
MD5 | 6dfa0817b8770f2da8cb6200e5731467 |
|
BLAKE2b-256 | b281ad6fc2d05d584aa87ebf79eafe06776e7bd7eabd7ad88d75005c265dfa1c |
File details
Details for the file txtimg-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: txtimg-0.0.8-py3-none-any.whl
- Upload date:
- Size: 94.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dae6dbae2b7fc1154608021776ab5f092ea72d661459cabc6751195250fd8ba5 |
|
MD5 | 1524b09716c0633e62298da031325b53 |
|
BLAKE2b-256 | d9876fc4c4973497444d3a9719d6c74b9bb9b5493995f9829e734a1f3589153d |