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 details)

Uploaded Source

File details

Details for the file tweetmagick-0.2.1.tar.gz.

File metadata

  • Download URL: tweetmagick-0.2.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for tweetmagick-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d61633457b533132ab3addd76d563a152404a55a832ba47d082fa4f140c3f77c
MD5 506ca978b6c61f5488f903e42708fcc1
BLAKE2b-256 505f2189babd7ef8d9d64f2ec42089f6fb904a82abb079a269e8a84c66ace9d2

See more details on using hashes here.

Supported by

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