Skip to main content

tweetmagick

Generate images with tweet-like appearance

Installation

pip3 install tweetmagick

Examples

Displaying the image and quitting without saving it can be done like so:

from tweetmagick import TweetGenerator

name = "harold"
longname = "stockmaster"
avatar = "harold.jpg"
text = "feeling pompous today, might delete later"
with TweetGenerator(name, longname, avatar, text) as tg:
    tg.tweetgen(debug=True)

tweetgen method returns BytesIO object with png binary blob. Below is the code that will save your image to a file:

from shutil import copyfileobj

with TweetGenerator(name, longname, avatar, text, theme="light") as tg:
    with open("haroldtweets.png", "wb") as tweet:
        copyfileobj(tg.tweetgen(), tweet)

Results in :

haroldtweets.png

With dark theme option:

haroldtweetsduringnight.png

TODO

Implement some streamlined method for embedding images in tweets.

Also some method for reply/quote images

Metadata

Release files for tweetmagick 0.2.1

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

Source distribution (sdist)

Source distribution for tweetmagick 0.2.1
File Size Uploaded
tweetmagick-0.2.1.tar.gz 4.4 kB Details

Release files / tweetmagick-0.2.1.tar.gz

Download URL tweetmagick-0.2.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d61633457b533132ab3addd76d563a152404a55a832ba47d082fa4f140c3f77c
BLAKE2b-256 checksum
How to use checksums
505f2189babd7ef8d9d64f2ec42089f6fb904a82abb079a269e8a84c66ace9d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.2

1 release file

0.1

1 release file

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