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

Uploaded Source

Built Distribution

txtimg-0.0.2-py3-none-any.whl (94.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: txtimg-0.0.2.tar.gz
  • Upload date:
  • Size: 93.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.0

File hashes

Hashes for txtimg-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7dead1d326cb408153be32046ddb8d8ee7992f7758dccc981161a0617944332a
MD5 83ef35d16a6d0d3c3f62242845ae6a0d
BLAKE2b-256 a6405e8b31c0ec0a419292b1504d781bcb156737e540782eedf9366b032e8ca0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: txtimg-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 94.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.0

File hashes

Hashes for txtimg-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1ca18df8439939997b6c7ad4e88cc6a2e3e75d3cb866789b4fdb1025c62c130a
MD5 754fb0730cfcebfcb7de73b2026ed56b
BLAKE2b-256 52c63009bdd5c54b585b3fe9249c484c151cd1267dbb21dce718de4001c77482

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