我基本上想要做的是使用jcrop裁剪图像,然后使用这些尺寸,旋转图像-30deg并保存缩略图。然而rmagick创建了额外的像素,因为旋转后没有涉及缩放。我想知道如何实现这一点。
# 150 x 150 is the final cropped image I want for my thumb(nails)
# :croppable is a file I use that takes the original and adds white padding in a 1200x1200
# file size so I can actually crop with white space available (you can't crop outside the
# original dimensions of the file)
has_attached_file :photo, :styles => {
:thumb => { :geometry => "150x150#", :format => :jpg, :processors => [:cropper] },
:general => ["150x375", :jpg],
:show => ["x425", :jpg],
:croppable => ["1200x1200>", :jpg]
},
:url => "/assets/w/:style/:w",
:path => ":rails_root/public:url",
:default_url => ":w_default",
:default_path => ":rails_root/public:w",
:default_style => :show,
:convert_options => {
:thumb => '-gravity center -rotate -30',
:croppable => '-gravity center -extent 1200x1200',
:general => '-gravity center -extent 150x375 -quality 95',
:all => '-quality 100 -antialias -flatten -background white -interlace Plane -unsharp 0.3x0.3+5+0'
},
:processors => [:thumbnail, :compression]
我最终想要做的是通过css变换旋转预览图像,以便预览实际显示裁剪后缩略图的样子。在这一点上,我不知道如何在回形针保存缩略图并旋转它时获得我想要的东西。
答案 0 :(得分:0)
找不到答案。我最终转向Carrierwave并遇到另一组问题,我终于找到了解决方案。太糟糕Carrierwave没有记录图像的处理,但这是一个很小的代价。
Carrierwave RMagick not removing transparency in convert to jpg
Carrierwave +repage option not working