i've got trouble for croping a picture with Rmagick and then display with Prawn
Here is the code :
First a method to instantiate the image with RMagick :
def build_magick_image(path)
if path.instance_of?(StringIO)
Magick::Image.from_blob(path.read)
else
Magick::Image.read(path)
end.first
end
In my case i have an instance of StringIO. Then i crop the picture :
img = build_magick_image(picture_path)
cropped_img = img.resize_to_fill(1735, 1560)
But now i can't find how to display it in my Prawn pdf. My last try is :
pdf.image cropped_img, at: [image_x, image_y], height: image_height.mm , width: inner_page_width.mm
But obviously it doesn't work.
Can someone help me?
Thanks :)