Getting a Binary Reponse using Curb

Hi guys,

I am new to ruby. I have the following problem.

I have a rendering engine that will take a svg and a set of params and
return a PNG image.

If I use curl on the command line passing the SVG it returns the image
as PNG and everything looks good.

I am trying to issue the same command using CURB but I have no idea how
to get the binary body.

I tried the following code:

  def get_product_image_curl(svg, image_name, w, h, region,

preview_url =

  c =
  svg = URI.escape(svg,"[^#{URI::PATTERN::UNRESERVED}]"))
c.http_post(Curl::PostField.content(‘design’, svg,

  return c.body_str

The body returns empty

The curls that works (same svg)
curl -v --data-urlencode [email protected] “http:///merchandise/344_480x480_Front.png?region=name:FrontCenter,w:23,h:63,a:TopCenter”


Any idea how to get the body our of the response?

Thanks in advance
Dalmer Azevedo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs