converting a tiff image

Does anyone know of a way to convert an uploaded tiff image into a jpg or png?

Mike Chai wrote:

Does anyone know of a way to convert an uploaded tiff image into a jpg or png?

http://github.com/thoughtbot/paperclip

Thanks. How can I use paperclip to convert? I tried looking it up in google but got no results.

Use :convert_options as shown here: http://www.taknado.com/en/2009/10/01/paperclip-tweaks/ (found using “paperclip rails convert file” on google). Someone else will be able to give you the imagemagick command parameter to convert to jpg I hope, don’t know it by heart.

Best regards

Peter De Berdt

This is actually used with AttachmentFu, but has some example code for Rmagick resizing:

http://github.com/kete/kete/blob/master/lib/resize_as_jpeg_when_necessary.rb#59

Cheers, Walter

The #59 meaning the relevant line is mainly the setting of format in line 59. There is other stuff in their you may find useful, too.

Cheers, Walter

Thanks for the replies. I'm using paperclip, but while search I still can't find out how to do this. I want to convert the image to jpg/png ONLY if it's a tiff image. I saw processors/callbacks in paperclip but I haven't found any way to make a Processor that can do this for me since I don't know how to call Imagemagick from ruby code. Would I need Rmagick for this and how would it play in with paperclip?

Thanks for the replies. I'm using paperclip, but while search I still can't find out how to do this. I want to convert the image to jpg/png ONLY if it's a tiff image. I saw processors/callbacks in paperclip but I haven't found any way to make a Processor that can do this for me since I don't know how to call Imagemagick from ruby code. Would I need Rmagick for this and how would it play in with paperclip?

you can try some third pdrty pdf converter dll to convert pdf to html ,i think can be much easier if a converter dll is employed. have a check!

I have only tried to convert Tiff files using the free trial package of another Tiff converter:

I am considering to employ one to help me. Do you have any good suggestion?

Install imagemagick on your server. It's free, and very powerful. Converting a TIFF to another image format is as simple as this:

  convert /path/to/image.tiff /path/to/output.jpg

Naturally, you can do almost anything and tweak almost anything, given the right flags passed to the convert command. If imagemagick can't open or understand the file, it's highly unlikely that it is an image at all.

Walter