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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: txtimg-0.0.6.tar.gz
  • Upload date:
  • Size: 94.3 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.6.tar.gz
Algorithm Hash digest
SHA256 7155ce8c998e41a9a531325d82cae74ae2ec7bfa5d883cd13a202942da6819b2
MD5 abd740d3265846d4422197c897906256
BLAKE2b-256 d374c42ee330e7be01a597735501b1a6daab64f4002fa0ade81c0059d285eab8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: txtimg-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 94.1 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 21aadff361dc383d5e0b80559aec547be5fadba55240187e85ecabe829e3093d
MD5 d4809e1edc1ba506f1ca04e8267d7a66
BLAKE2b-256 c865d6e54dc8c23d957d3622d808863b1691f92a8669b11925db374201774685

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