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

Uploaded Source

Built Distribution

txtimg-0.0.3-py3-none-any.whl (63.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: txtimg-0.0.3.tar.gz
  • Upload date:
  • Size: 62.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.3.tar.gz
Algorithm Hash digest
SHA256 de716b91c937a37f3f81d0f32b12ffb788d9cafe4deb0020ce064ea59b67e5e9
MD5 e5a9cc0332eee5d06210483ed33cb383
BLAKE2b-256 09ca3bf588830093cd0f127d8c0dbad3e222051aafa11ceb086d2148dc72c8f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: txtimg-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 63.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3d93fc0303622ed1fffb7f7e2892b125e7b2226ffafba0229f371e2dbe691b20
MD5 57b82cfe4144eab57c7e6c74a8f57059
BLAKE2b-256 c300c4b568dbb59b3d42f7e356b1f9860f667c5526f668788d5de9a1bcb6f262

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