Skip to main content

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


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.5.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

txtimg-0.0.5-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file txtimg-0.0.5.tar.gz.

File metadata

  • Download URL: txtimg-0.0.5.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

Hashes for txtimg-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e05584f93139d854df56da4a42e0f9ecde38200c478a30131288a9b460e0bf3c
MD5 1352e1d416a52a5b06dee47c8032da2f
BLAKE2b-256 ebb669e75a8bb3611d16a4b5ba39a02a3fd3e2dc30c978837f1653d7d52de078

See more details on using hashes here.

File details

Details for the file txtimg-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: txtimg-0.0.5-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

Hashes for txtimg-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 700b5e93f9db3478bcbffa099a0edaff4160d2a15e51cd682ff597a97fb4ef05
MD5 1e0bfcd5d25c007a55dcf658192aa508
BLAKE2b-256 8eba3e1f5566b33ab19eff2bffd1420df44209051051e7a8b884118efb896d00

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page