Croping image with image_processing and MiniMagic

Hi there,

I’m trying to crop an image with ImageProcessing::MiniMagick but it seems it’s not working.

 class UserProfileAvatarUploader < ImageUploader
  plugin :default_url
  plugin :add_metadata

  Attacher.default_url do |derivative: nil, **|
    file&.url if derivative

  Attacher.derivatives(:user_profile_avatar) do |original|
    magick = ImageProcessing::MiniMagick.source(original)
    magick = magick.crop(*file.crop_points)
    # magick.crop(*file.crop_points) # also not working
      square: magick.resize_to_fill!(400, 400),
      rectangle: magick.resize_to_fill!(800, 450)

  class UploadedFile
    def crop_points
      metadata.fetch('crop').fetch_values( 'width', 'height', 'x', 'y')

If I change to ImageProcessing::Vips everything works fine.

Any help would be appreciated.

Hi, the MiniMagick processor requires a direct ImageMagick geometry string at the moment:


I plan to address this in the next version of ImageProcessing, which will add the same #crop API that the Vips processor already has.

Thank you for your answer! I’ve already solved it that way, sorry for not answering.