我将使用paperclip gem来处理图像。
在某些图像中,我需要裁剪源图像的顶部35个像素,然后进行转换和处理。
目前我正在使用
在某些图像中,我需要裁剪源图像的顶部35个像素,然后进行转换和处理。
目前我正在使用
:convert_options => {
all: lambda{ |instance| "#{!instance.chop_top.blank? ? '-chop 0x35' : '' } -limit memory 64 -limit map 128"},
mobile_sm: "-resize 620 -quality 90 -strip -interlace Plane",
mobile_lg: "-resize 1280 -quality 80 -strip -interlace Plane",
feature: "-quality 90 -strip -interlace Plane",
medium: "-quality 85 -strip -interlace Plane",
preview: "-quality 85 -strip -interlace Plane",
tiny: "-quality 90 -strip -interlace Plane"}
这个方法基本可行,但在mobile_lg
上似乎是在调整大小后才进行裁剪的(我猜其他设备也有这个问题,只是不太明显)。
我该如何使用-chop
使其在调整大小之前进行裁剪呢?