Converting gif images to png images on the fly for PDF generation

I have been using the prawn library + prawnto plugin to generate PDF
from a set of models. each model has one or more images associated with
and I include each of these images into the pdf by looping through the
images collection associated with the model. (the images have been
with paperclip.)
Prawn does not support pdf generation from GIF - only jpg or png. is
there a
way for me to check if an image is a gif and convert it on the fly into
png image in my prawnto view?
I guess converting the image into a png while uploading would also work
as I have a bunch of GIFs already uploaded, and Prawn throws up an
file is an unrecognised format” when generating the PDF from those
models, I
would appreciate a solution where the image is converted into a png and
included into the pdf.
my prawn view: (there are a bunch of cards - each card has a message and
images) do |card|
pdf.text sanitize(card.message),:align => :center, :size => 30, :style
card.images.each do |pic|

picture = “#{RAILS_ROOT}/public#{}”.sub!(/?.+\Z/, ‘’)
pdf.image picture, :position => :center, :vposition => :center



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