Skip to main content

Create images that look like tweets

Project description

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

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

tweetmagick-0.2.1.tar.gz (4.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page