Rails 3 / paperclip / imagemagick - 合并两个图像 [英] Rails 3/ paperclip/ imagemagick - merging two images

查看:166
本文介绍了Rails 3 / paperclip / imagemagick - 合并两个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户在我的rails应用程序中上传图像时,imagemagick处理两个转换:

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

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

生成一个列表大小(方形50x50px)图像。此时是否可以将此图像与标准透明png合并,使图像看起来更像图标? (我有png图像,我只是想知道是否可以渲染另一个将这个默认透明png放在:listsize图像上的照片样式)。谢谢

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

推荐答案

Imagemagick是一个完整的图像处理库,因此一切皆有可能。 Paperclip还支持后期处理。

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

检查Rmagick文档 http:/ /rmagick.rubyforge.org/

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

还有关于后处理的Paperclip文档 https://github.com/thoughtbot/paperclip

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

我个人也建议你研究一下carrierwave https://github.com/jnicklas/carrierwave

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

这篇关于Rails 3 / paperclip / imagemagick - 合并两个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆