Rails 3/ paperclip/ imagemagick - merging two images

匆匆过客 提交于 2019-12-11 00:32:24

问题


When a user uploads an image in my rails app imagemagick handles two transformations:

 has_attached_file :photo, :styles => { :listsize => "50x50#", :articlesize => "300x300" },

a listsize (square 50x50px) image is produced. Is it possible to at this point merge this image with a standard transparent png that would make the image look more like an icon? (I have the png image, I just want to know if it's possible to render another photo style that has this default transparent png placed over the :listsize image). Thanks


回答1:


Imagemagick is an entire image processing library and thus anything is possible. Paperclip also supports post processing.

Check the Rmagick documentation http://rmagick.rubyforge.org/

And also the Paperclip documentation on post processing https://github.com/thoughtbot/paperclip

I personally would also advise you to look into carrierwave also https://github.com/jnicklas/carrierwave



来源:https://stackoverflow.com/questions/7137342/rails-3-paperclip-imagemagick-merging-two-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!