Rails 6 Active Storage image_processing gem issue

Using Rails 6.0 and 'image_processing', '~> 1.9.3'

When trying to show a cropped variant of an image with:

url_for(user.avatar.variant(crop: crop_geometry)&.processed)

I get an error:

You must have ImageMagick or GraphicsMagick installed

I thought that image_processing gem included any dependencies relatives to this. Should I install some missing dependencies or what? Thanks


Solution 1:

It's in the docs, first step, you need to instal dependencies: https://github.com/janko/image_processing

1. Install ImageMagick and/or libvips:
> $ brew install imagemagick vips

I highly recommend using vips, it's much faster.

Solution 2:

You have to install library first.

For Mac user:

brew install imagemagick vips

For debian/ubuntu user:

sudo apt update
sudo apt install imagemagick libvips