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.7.tar.gz
(94.4 kB
view details)
Built Distribution
txtimg-0.0.7-py3-none-any.whl
(94.1 kB
view details)
File details
Details for the file txtimg-0.0.7.tar.gz
.
File metadata
- Download URL: txtimg-0.0.7.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 | 42bbc5774bac2364c275c1a59741dd28de5916fa894b5e7e364124371aa40e4c |
|
MD5 | 93f0e87bbab8dc6fa54fac41d2b2737f |
|
BLAKE2b-256 | f4d3d5606dd8cd12830ca2e68202b7633a84c2fd49489d7f302f3d1433054b38 |
File details
Details for the file txtimg-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: txtimg-0.0.7-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 | e9eb8035d59746c173f361b00187e76a7b1f58556e6bd266415965b081a246c2 |
|
MD5 | 59ae80385766b9f657fd2dd8eeee5fe0 |
|
BLAKE2b-256 | 6f200b11390377ca51aadc5dd14b88e1dba0689d5ae2a989aa0e05cda0d0adc0 |