ruby on rails 4 - Use chop before resize in Imagemagick -


i using paperclip gem process images.

in images, need chop top 35 pixels of source image , conversions , processing

currently using

: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"} 

this works, mostly, on mobile_lg seems chop occurs after resizing (and guess happens on others well, less visible)

how can use -chop before resize?

solved +repage , not in :all

so looks

all: "-limit memory 64 -limit map 128",     mobile_sm: lambda{ |instance| "#{!instance.chop_top.blank? ? '-chop 0x31 +repage' : '' } -resize 640 -quality 90 -strip -interlace plane"},     mobile_lg: lambda{ |instance| "#{!instance.chop_top.blank? ? '-chop 0x31 +repage' : '' } -resize 1280 -quality 80 -strip -interlace plane"}, 

it can refactored, c'est la vie

for reason, putting lambda in all doesn't work, guess behavior different.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -