DEV Community

Cover image for Generate Stylized Text Images with Python (No Photoshop, No Fuss)
Hrituraj
Hrituraj

Posted on

Generate Stylized Text Images with Python (No Photoshop, No Fuss)

I needed a quick way to generate styled banner text for a side project. Nothing fancy — just something that looked good enough to drop into a README or a Telegram bot reply. I didn't want to open Photoshop, wrestle with Pillow font rendering, or sign up for yet another API.

Turns out there's a Python wrapper for CoolText.com called pycooltext-api, and it does exactly what it says.


What it does

CoolText has been around forever. It's one of those websites that's been quietly generating flame text and bubble letters since the early 2000s. The site has a /PostChange endpoint that accepts a logo ID plus some config, and hands back a rendered image URL.

pycooltext-api wraps that into a typed Python interface. You pick a logo, pass some text, and get a URL (or a downloaded file) back.


Install

pip install pycooltext-api -U
Enter fullscreen mode Exit fullscreen mode

Basic usage

from cooltext import CoolText, PostChangeConfigOptions

config = PostChangeConfigOptions(LogoID="732440996", Text="Hello World")
result = CoolText(config).create()

print(result)        # prints the image URL
result.download()    # saves the image locally
Enter fullscreen mode Exit fullscreen mode

That's it. LogoID is the only required field besides Text.

The CoolTextResult object you get back is designed to fail gracefully — if the request bombs for some reason, you get a falsy result and a logged error rather than an exception blowing up your script.


Finding logo IDs

This is honestly the most annoying part. The library ships with a search tool:

from cooltext import CoolTextSearch

results = CoolTextSearch().search("gold")
for r in results:
    print(r.title, "-", r.link)
Enter fullscreen mode Exit fullscreen mode

That gives you titles and links. But if you want to actually browse visually, there's a hosted gallery where you can see previews alongside IDs. I'd start there.


Configuration options

Most logos have sensible defaults, but you can override them:

config = PostChangeConfigOptions(
    LogoID="2975689126",
    Text="My Project",
    FontSize="90",
    FileFormat="6",           # PNG transparent (default)
    Color1_color="FF4500",    # primary text colour (hex, no #)
    BackgroundColor_color="000000",
)
Enter fullscreen mode Exit fullscreen mode

FileFormat controls the output type:

Value Format
1 GIF with background
2 GIF transparent
4 JPG
5 PNG with background
6 PNG transparent (default)

There's also a handful of logo-specific parameters (Boolean1Boolean3, Integer1Integer14_color) for logos that have extra toggles baked in.

If you're not sure what defaults a logo uses, you can pull them:

defaults = CoolText(config).get_defaults()
print(defaults)
Enter fullscreen mode Exit fullscreen mode

CLI

There's a command-line interface too. It requires rich:

pip install rich
cooltext "Hello World"
cooltext "Hello World" --logo 732453157 --save banner.png
Enter fullscreen mode Exit fullscreen mode

Search from the terminal:

cooltext search fire
cooltext search "neon" --limit 1
Enter fullscreen mode Exit fullscreen mode

If cooltext isn't found after install, run it with Python directly:

python -m cooltext "Hello World"
Enter fullscreen mode Exit fullscreen mode

Where it fits

This isn't a tool for production-grade image generation. But for quick banners, README headers, Discord bots, Telegram replies — it's surprisingly useful. The API is free, the setup is two lines, and you don't have to manage any fonts or rendering pipeline yourself.

The library is on PyPI as pycooltext-api. Source is on GitHub — MIT licensed.

Top comments (0)