Use cropping before resizing in Imagemagick

I am using paperclip gem for image processing.

In some images, I need to slice the top 35 pixels of the original image, and then do the transforms and processing

I am 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 mainly, but mobile_lgit seems that grinding occurs after resizing (and, I think, this happens on others, it is just less noticeable)

How can I use -chopit to do this before resizing?

+4
source share
1 answer

resolved it with help +repageand not in:all

so essentially it looks like

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

he can be reorganized, but c'est la vie

- , all, , , .

0

All Articles