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
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)
| File | Size | Uploaded | |
|---|---|---|---|
| pynter-0.1.6.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|