How to convert a tweet to image

Google has a secret screenshot API

For example, you can use it to get a screenshot of a tweet like this

https://www.googleapis.com/pagespeedonline/v1/runPagespeed?screenshot=true&strategy=mobile&url=https%3a%2f%2ftwitter.com%2fedent%2fstatus%2f661570680253755392

At the bottom of that JSON response, you'll see

"screenshot": {
     "data": "_9j_4AAQSkZJRgAB.....=",
     "height": 569,
     "mime_type": "image/jpeg",
     "width": 320
 }

You will need to Base64 decode it using the URL and Filename safe alphabet.

That will give you a JPG screenshot of the Tweet.


I've created a small web-app to convert tweets to images. It connects Twitter's embed URL with Puppeteer in the backend and take a screenshot. You can also change some parameters like image width, padding, theme and download the image as a png file.

It's open source so you can take a look at the code.

https://github.com/ozgrozer/tweet-image

https://tweet-image.glitch.me/

enter image description here


You can now get images or screenshots of tweets using the @aissistant handle on twitter.

Retweet or reply to any tweet with the comment "@aissistant #image" to get an image. 
Retweet or reply to any tweet with the comment "@aissistant #screenshot" to get a screenshot.
Retweet any tweet containing images or videos with the comment "@aissistant #video" to get a video.

For other options like converting to memes and jokes check out the handle.

Full disclosure: I am creator of the bot behind the handle.