Ruby · HTML to Image
Convert HTML to Image in Ruby
Use Ruby's standard Net::HTTP or Faraday to call the renderpix API. Drop-in replacement for wicked_pdf or prawn when you need images, not PDFs.
Rubyrenderpix API example
require "net/http" require "json" html = <<~HTML <div style="padding:48px;background:#0f172a;color:white; font-family:sans-serif;border-radius:12px;width:800px"> <h1>Social Card</h1> <p style="color:#94a3b8">Developer profile image</p> </div> HTML uri = URI("https://renderpix.dev/v1/render") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true req = Net::HTTP::Post.new(uri) req["X-API-Key"] = "rpx_your_key" req["Content-Type"] = "application/json" req.body = { html: html, width: 800, height: 400, format: "png" }.to_json res = http.request(req) File.write("card.png", res.body, mode: "wb")
Common use cases
Rails ActiveJob
Queue image generation as background jobs in Rails apps.
Action Mailer
Embed generated images in transactional emails.
EdTech platforms
Auto-generate certificates for completed courses.
API services
Build image generation into Sinatra microservices.
Start converting HTML to images for free
100 free renders/month. No credit card. Set up in 2 minutes.
Get free API key