Skip to main content
Latest PyPI version

Minimal utility for generating images with textual caption

Usage

  1. Download an image

    curl https://i.imgur.com/XQCKcC9.jpg -o ./image.jpg

  2. Download a font

    curl https://fonts.google.com/download?family=Roboto -o ./roboto.zip ; unzip ./roboto.zip -d ./Roboto

  3. Provide a caption and Generate the image:

    from pynter.pynter import generate_captioned
    font_path = './Roboto/Roboto-Regular.ttf'
    image_path = './image.jpg'
    im = generate_captioned('China lands rover on Mars'.upper(), image_path=image_path, size=(1080, 1350),
                            font_path=font_path, filter_color=(0, 0, 0, 40))
    im.show()
    im.convert('RGB').save('drawn_image.jpg')

Results will look like:

https://i.imgur.com/fS6vPNm.jpg

Image Generation

generate_captioned( text: str,

image_path, size: Optional[Tuple[int, int]] = None, font_path: str = None, text_align: TextAlign = TextAlign.LEFT, bottom_margin: Optional[float] = 0.07, top_margin: Optional[float] = None, left_margin: float = 0.2, right_margin: float = 0.2, character_ratio: float = 0.07, filter_color: Tuple[int, int, int, int] = (0, 0, 0, 0), text_background_color: Tuple[int, int, int, int] = (0, 0, 0, 180), text_background_padding: float = 0.2, text_background_mode: TextBackgroundMode = TextBackgroundMode.STRIPE, filters: [BuiltinFilter] = [], color: Tuple[int, int, int, int] = (255, 255, 255, 255)) -> Image:

Installation

pip install pynter

Metadata

Release files for pynter 0.1.6

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

Source distribution (sdist)

Source distribution for pynter 0.1.6
File Size Uploaded
pynter-0.1.6.tar.gz 5.2 kB Details

Built distribution (wheel)

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

Total release size: 10.9 kB

Release files / pynter-0.1.6.tar.gz

Download URL pynter-0.1.6.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5779e4352f74eeb7e3502406039be96e81e4986f44af6682e7968e9e6ea88f1e
BLAKE2b-256 checksum
How to use checksums
1bbcc2b682785fd1ebad68485912a3c1b1783277aee4b5811b9e6c6dc0ca0137
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.3 CPython/3.8.12

Release files / pynter-0.1.6-py3-none-any.whl

Download URL pynter-0.1.6-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
553a2a3fa1e06af73c1ec9064440ea507dfb6f5fbf5c27e854c8ce9c4140147b
BLAKE2b-256 checksum
How to use checksums
83c3f4c9cc0dcf17688d18f3197e2131dad116af333ec4f18b4d56da93bbe139
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.3 CPython/3.8.12

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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