Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom ImageMagick scripts on Rails (Paperclip ?)

I would like to use some of these scripts: http://www.fmwconcepts.com/imagemagick/ for processing images uploaded to my Rails app. How can I achieve it? Can I set it up in Paperclip somehow or need to write some custom code?

like image 746
sNiCKY Avatar asked Jan 27 '26 06:01

sNiCKY


2 Answers

Paperclip provides a way to write your own image processor, which primarily make use of the command line tools provided by imagemagick and the like.

Since the scripts you link to above are all command line tools, it will be fairly trivial to write a processor to use these.

Resources:

  • Railscast #182 uses a custom processor to do cropping.
  • The default thumbnail processor of Paperclip provides good documentation on how your own processors can be achieved.
like image 65
Douglas F Shearer Avatar answered Jan 28 '26 18:01

Douglas F Shearer


You might want to consider CarrierWave instead of Paperclip. It's easier to customize the image processing behavior with CarrierWave and RMagick.

The Railscast about CarrierWave is an excellent starting point:
http://railscasts.com/episodes/253-carrierwave-file-uploads

like image 28
Christoph Schiessl Avatar answered Jan 28 '26 18:01

Christoph Schiessl