只是试图通过回形针和 imagemagick 为图像添加水印。这是我的水印处理器的要点: https ://gist.github.com/xamenrax/6164246
我的模型是:
CONVERT_OPTION_PREFIX = "-background transparent -compose Copy -gravity center -extent"
has_attached_file :image,
:processors => [:watermark],
:styles => {
:slider => { geometry: "480x226#", watermark_path: "#{Rails.root}/public/images/watermarks/medium/watermark.png" },
:big => { geometry: "670x426#", watermark_path: "#{Rails.root}/public/images/watermarks/big/watermark.png" },
:medium => { geometry: "155x160#", watermark_path: "#{Rails.root}/public/images/watermarks/thumb/watermark.png" },
:thumb => { geometry: "106x160#", watermark_path: "#{Rails.root}/public/images/watermarks/thumb/watermark.png" },
:wide_medium => { geometry: "220x150#", watermark_path: "#{Rails.root}/public/images/watermarks/thumb/watermark.png" },
:square => { geometry: "100x102#", watermark_path: "#{Rails.root}/public/images/watermarks/square/watermark.png" }
},
convert_options: { slider: "#{CONVERT_OPTION_PREFIX} 480x226", big: "#{CONVERT_OPTION_PREFIX} 670x426", medium: "#{CONVERT_OPTION_PREFIX} 155x160", wide_medium: "#{CONVERT_OPTION_PREFIX} 220x150", square: "#{CONVERT_OPTION_PREFIX} 100x102" }
但是保存图像时出现错误:
Command 'composite -gravity SouthEast '/Users/xamenrax/projects/handmadefood/public/images/watermarks/medium/watermark.png' '/var/folders/26/0fjt3lc101x1714cc5xxkfgc0000gn/T/pro20130806-1681-i05d3l20130806-1681-1yvw0r1' -resize '480x' -crop '480x226+0+127' +repage '/var/folders/26/0fjt3lc101x1714cc5xxkfgc0000gn/T/pro20130806-1681-i05d3l20130806-1681-1yvw0r1'' returned 1. Expected 0
有什么问题?-crop 是'480x226+0+127'
无效选项吗?