A bot to convert top threads of reddit to instagram photos
The task is to make a bot that would fetch the top thread of /r/ShowerThoughts and convert it to image. Post it to instagram.
This is the basic MVP idea. More things can be done. But lets build this first.
- Fetching top thread of the day.
- Official Documentation: Documentation here.
- Using most popular JS Wrapper : Snoowrap
So this the is the RDS of the app.
The idea is to convert the text to an image. I have found various libraries and methods which can help with this task. But the goal is to find the most flexible method, which provide
-
Using JIMP :
- Jimp does not have any dependencies. Written in pure JS it can write text over an image. It also provides various image filtering and editing functionalities.
-
Using Canvas :
-
Using
node-canvas
to generate a canvas at the server side. Convert it to the image. -
Canvas has tonnes of methods to generate anything you want.
-
I tried to hack this : https://codepen.io/sagark/pen/Njxmvj
-
-
Server Side Rendering :
-
Using a template engine (preferably EJS) rendering a dynamic page, by passing text, background parameters like gradient colors, user name and other variables.
-
Using Pageras to take the screen shot of the dynamic generated page.
-
Provides huge flexibility with html and css as passing variables to ejs file and changing the to create dynamic pages.
Made this template
Disclaimer : I suck at CSS
-
How to choose background ?
-
Gradient Images :
-
List of gradients can be found here
-
Preview here : https://uigradients.com/
-
-
Intelligent Images :
-
Find keywords from the text using [natural](https://githu b.com/NaturalNode/natural)
-
Search keywords in unsplash to find an image. Using it as a background.
-
-
How to choose text colors?
- Using VibrantJS
* Will update later.
-
Production Quality / Inspiration : Official instagram of r/ST