Minimal utility for generating images with textual caption
Project description
Minimal utility for generating images with textual caption
Usage
Download an image
curl https://i.imgur.com/XQCKcC9.jpg -o ./image.jpg
Download a font
curl https://fonts.google.com/download?family=Roboto -o ./roboto.zip ; unzip ./roboto.zip -d ./Roboto
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:
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynter-0.1.6.tar.gz.
File metadata
- Download URL: pynter-0.1.6.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5779e4352f74eeb7e3502406039be96e81e4986f44af6682e7968e9e6ea88f1e
|
|
| MD5 |
9abe8581ae72ac0ea019acced6b99cae
|
|
| BLAKE2b-256 |
1bbcc2b682785fd1ebad68485912a3c1b1783277aee4b5811b9e6c6dc0ca0137
|
File details
Details for the file pynter-0.1.6-py3-none-any.whl.
File metadata
- Download URL: pynter-0.1.6-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
553a2a3fa1e06af73c1ec9064440ea507dfb6f5fbf5c27e854c8ce9c4140147b
|
|
| MD5 |
010de321eff9e45d982ba61e08909ec1
|
|
| BLAKE2b-256 |
83c3f4c9cc0dcf17688d18f3197e2131dad116af333ec4f18b4d56da93bbe139
|