Create stunning release post covers

April, 2024
Zoran Žabčić

In the world of software development, releasing updates or new versions of applications is common. Alongside these releases comes the need for catchy cover images to announce them effectively. To make this process easier, the Release Image gem steps in as a useful tool.

The Release Image gem is a simple tool designed specifically to help create cover images for release posts or notices within your application. It makes it easy to include essential elements like your app's logo, version, and release date in the images. It also lets you pick from a large collection of images from Unsplash service.

You have the option to select images based on your chosen keywords, and the tool will return a random image. Additionally, it automatically incorporates the current annual season into the mix. However, the overall experience is always exciting as you never know which image will appear. If you're not satisfied with the result, you can always request another one, ensuring that you find the perfect fit for your needs.

Usage Example

You can incorporate a script like the following, named bin/release_image, to generate images:

#!/usr/bin/env ruby

require "dotenv/load"
require "optparse"
require "colorize"
require "release_image"

APP_ROOT = File.expand_path("..", __dir__)

options = {} do |opts|
  opts.banner = "Usage: bin/release_image version [date] [options]"

  opts.on("--skip-download", "Skip downloading a random image and use a previously downloaded image instead.") do
    options[:skip_download] = true

  opts.on("-h", "--help", "Prints this help") do
    puts opts

# Get api key at:
# keywords - An array of keywords that can be used to filter the random image
# folder_path - The destination folder where the generated images will be saved
# logo_path - The path to your app's logo image
# seasons - Generate images based on the current season of the year

ReleaseImage.config.api_key     = ENV.fetch("UNSPLASH_API_KEY")
ReleaseImage.config.keywords    = %w[nature wallpaper]
ReleaseImage.config.folder_path = File.join(APP_ROOT, "tmp/release_image")
ReleaseImage.config.logo_path   = File.join(APP_ROOT, "app/assets/images/logo/release_logo.png")
ReleaseImage.config.seasons     = true

version = ARGV[0]
date    = ARGV[1]

abort("Please provide a release version".red) unless version

puts ReleaseImage.generate(version: version, date: date, skip_download: options[:skip_download]).green

This script sets up the necessary dependencies and options for the bin/release_image command. It allows you to specify the version and date for generating cover images, with the option to skip downloading and use a previously downloaded image.

# Generate a cover image for version 4.1.1 with the date 18.03.2024
bin/release_image 4.1.1 18.03.2024

# Alternatively, you can use a different date format
bin/release_image 4.1.1 2024-3-18

# Skip downloading and use a previously downloaded image
bin/release_image 4.1.1 18.03.2024 --skip-download

# Generate a cover image for version 4.1.1 with the current date
bin/release_image 4.1.1

Upon successful generation of the cover image, it will output the path to the image file. In our example, the path to the generated image will be APP_ROOT/tmp/release_image/release_4_1_1.png.

Release image