rdyson / quick-text-image

Node script to create a quick text overlay on a random image, for sharing on Instagram and elsewhere.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quick Text Image

This is a node script that adds text to an image background for sharing on Instagram. You can run it from the command line.

Here's how it works:

  1. Grabs a random image from Unsplash via Lorem Picsum
  2. Adds a text box and given text using image transformations on Cloudinary
  3. Returns a Cloudinary URL that you can share or use to download the image for posting on Instagram.

Installation and usage

  1. Clone this repository
  2. In the repository directory, run npm install. Alternately you can run yarn.
  3. Create a free Cloudinary account and grab your CLOUDINARY_URL environment variable from your Cloudinary admin console. The free account includes 20,000 transformations, so you shouldn't have an issue of hitting any limits. (each run of this script counts as 2 transformations)
  4. Export your CLOUDINARY_URL as an environment variable by adding it to your bash_profile or zshrc. Alternately you can set the environment variable temporarily by running export CLOUDINARY_URL=...
  5. Run node quick.js Lorem ipsum, replacing Lorem ipsum with whatever text you want to use.
  6. You'll get back a URL for the image. Running the command again will return a different image.

Here's an example:

Notes

  • Works pretty well up to 160 characters. You can tweak the font size on line 43 to accommodate more text. _100 is the current font size, which is 100px.
  • Doesn't handle commas yet.

About

Node script to create a quick text overlay on a random image, for sharing on Instagram and elsewhere.


Languages

Language:JavaScript 100.0%