Skip to main content

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.

Release files for txtimg 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for txtimg 0.0.9
File Size Uploaded
txtimg-0.0.9.tar.gz 94.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for txtimg 0.0.9
File Interpreter ABI Platform
txtimg-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 188.4 kB

Release files / txtimg-0.0.9.tar.gz

Download URL txtimg-0.0.9.tar.gz
Size 94.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8e1e4236d9918423c6c2c43d4b2e5da37fb052d4cf3b69bdfd296412611b15ab
BLAKE2b-256 checksum
How to use checksums
2897956dd3a392cd89b4c2e39a3102b50481c8745a61117303be048e3342dd98
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / txtimg-0.0.9-py3-none-any.whl

Download URL txtimg-0.0.9-py3-none-any.whl
Size 94.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af1fae3a1719435a55922c7a79fbcfce34e64ac9a8c1b63a7ae8364978d993c6
BLAKE2b-256 checksum
How to use checksums
ff7a2014dda8b58ad66125a2fa106bf8cfb61144025138e2f1ba8da33bfc1279
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page