Free Trial
10 days, no credit_card

<< More Tutorials

How to resize an image to cover any dimensions in Ruby using rethumb?

To resize an image, with our "cover" operation, in Ruby use the following code:

require 'net/http'

param_operation = "cover"
param_value = "150x200" # New WIDTHxHEIGHT in pixels.

image_url = ""
image_filename = "resized-image.jpg"

Net::HTTP.start("") do |http|
    resp = http.get("/v1/#{param_operation}/#{param_value}/#{image_url}")
    open(image_filename, "wb") do |file|

Start using this example now

Use the following commands to get started:

$ git clone
$ cd rethumb-ruby-examples
$ ruby cover.rb

More examples using Ruby