ruby on rails - How to create circular images using Prawn -
is possible clip or apply mask image using prawn.
for example, i'm embedding image pdf using image http://path/to/image
. image square, pdf design requires circle.
with html/ css apply radius image achieve effect. there way similar prawn?
based on sunil-antony's answer, came following solution (using save_graphics_state
enclose drawing instructions, see prawn documentation):
prawn::document.generate("x.pdf") image_width = 200 image_x = 100 image_y = 100 save_graphics_state soft_mask fill_color 0,0,0,0 fill_circle [image_x + image_width/2, image_y - image_width/2], image_width/2 end image "example.jpg", at: [image_x, image_y], width: image_width, height: image_width end end
Comments
Post a Comment