rails image optimization

Optimize Rails and Active Storage images without changing upload workflows

Keep originals in Active Storage, S3, a CMS, or your current public origin. Rails views can request Skymage URLs for exact dimensions, stable crops, WebP or AVIF output, and cached delivery.


# app/helpers/skymage_helper.rb
module SkymageHelper
  def skymage_url(source, params = {})
    query = Rack::Utils.build_query(params)
    "https://demo.skymage.net/v1/#{source}#{query.present? ? "?#{query}" : ""}"
  end
end

<%= image_tag skymage_url(product.image_url, w: 520, h: 390, fit: "cover", f: "webp", q: 82),
  width: 520,
  height: 390,
  loading: "lazy",
  alt: product.name %>
where it fits

Start with Rails views where images repeat

A useful Rails image optimization test starts with one public route, one repeated image helper or partial, and a measurable surface such as product cards, avatars, gallery images, or CMS media.

Active Storage uploads

Request right-sized variants from public blob or CDN-backed URLs without creating new variant records first.

Product and listing views

Serve card, gallery, and detail images with explicit width, crop, format, and quality settings.

SaaS and marketplace media

Normalize avatars, screenshots, logos, and user uploads into predictable view sizes.

implementation

Keep URL generation in one Rails helper

A helper or presenter can centralize the Skymage prefix while each ERB, ViewComponent, or partial asks for the dimensions it actually renders.


def product_card_image(product)
  skymage_url(product.image_url, {
    w: 520,
    h: 390,
    fit: "cover",
    f: "webp",
    q: 82
  })
end

<%= image_tag product_card_image(product), width: 520, height: 390, loading: "lazy" %>
evaluation path

A practical Rails image CDN test answers four questions

Origin fit

Can Skymage transform the public image paths your Rails app already renders?

View slots

Can each repeated partial request the exact dimensions it displays?

Format output

Can routes ship WebP or AVIF without changing uploads or background jobs?

Rollout risk

Can one helper prove the pattern before changing every image view?

free check

Get a Rails image route audit

Send one public Rails route. The free audit will identify the repeated image surface to test first, the Skymage URL parameters to try, and whether the current origin supports a low-risk rollout.

deploy

Start shipping lighter images.

Create a Skymage CDN URL, prepend it to your existing image URLs, and let the edge handle optimization, transforms, and delivery.

No credit card required. 14-day free trial.

Test one image-heavy page first. Paste a URL for a free check, or start a trial with the same tracked source.
Full form Start trial