Rails 3/ paperclip/ imagemagick - 合并两个图像
当用户在我的 Rails 应用程序中上传图像时,imagemagick 会处理两个转换:
has_attached_file :photo, :styles => { :listsize => "50x50#", :articlesize => "300x300" },
生成一个列表大小(方形 50x50px)图像。此时是否可以将此图像与标准透明 png 合并,使图像看起来更像一个图标? (我有 png 图像,我只是想知道是否可以渲染另一种照片样式,并将此默认透明 png 放置在 :listsize 图像上)。谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Imagemagick 是一个完整的图像处理库,因此一切皆有可能。回形针还支持后期处理。
查看 Rmagick 文档 http://rmagick.rubyforge.org/
以及有关后期处理的 Paperclip 文档 https://github.com/thoughtbot/paperclip
我个人也建议您研究一下rierwave https://github.com/jnicklas/rierwave
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