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.4.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file txtimg-0.0.4.tar.gz
.
File metadata
- Download URL: txtimg-0.0.4.tar.gz
- Upload date:
- Size: 2.6 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 | 1d730ca538d36610631246b503e8ca54e698a8893a50a0b7db06380aa02069fb |
|
MD5 | 48a185ca6b85a2cedbbfe82e8fed126c |
|
BLAKE2b-256 | 0ce6ee6a41c22fa2ec2341a04240c0d780bb405fc11cd63246c2a67b0c306698 |
File details
Details for the file txtimg-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: txtimg-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.5 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 | e394a89f7ce5fa81d3e8f54905a55326ee1b4420c493566afbfc2c395a22d05d |
|
MD5 | c820258952e0dbe1a4e9de525c0872a2 |
|
BLAKE2b-256 | e93f507d964951d6813b8878ae1fd36d4c04e52a68b3c7550b74320fec217c24 |