Unable to crop image using mini_magick

nil picture nil · May 4, 2012 · Viewed 8.6k times · Source

I am using mini_magick as the interface of utilizing ImageMagick to manipulate some image. The resize works fine. But when I want to crop some image:

img = MiniMagick::Image.open(url)
img.crop('200x800!')

It constantly prompts No such file

No such file or directory - /var/folders/c4/mqlwdx_d3kj6hqcnvbjr9mn80000gn/T/mini_magick20120504-11111-16kayc1.png

Answer

nil picture nil · May 4, 2012

Ah, I was searching with wrong key phrase I guess. The right answer come to me when I search minimagick instead of mini_magick. Undefined Method crop! Using Carrierwave with MiniMagick on rails 3.1.3 especially this answer https://stackoverflow.com/a/9961434/179691

I did know the stuff about mini_magick is just a wrapping of mogrify and so. The cause of my problem is that -crop accepts full formatted geometry only. so I changed the expression to:

img.crop('200x800+0+0')

and that works.