Skip to content

Latest commit

 

History

History
60 lines (38 loc) · 1.15 KB

README.md

File metadata and controls

60 lines (38 loc) · 1.15 KB

MiniMagick cliping images with mask file

Gem Version

Use mask file to clip images with minimagick.

MiniMagick clip with mask

Installation

Add this line to your application's Gemfile:

gem 'mini_magick_clip'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mini_magick_clip

Usage

Carrierwave example:

class AvatarUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick
  include MiniMagickClip

  process convert: 'png'

  version :thumb do
    process resize_to_fill: [210, 210]
    process mask: Rails.root.join('app/uploaders/t-shirt-mask.png')
  end

  def filename
    if original_filename
      [
        model.username,
        "png"
      ].join(".")
    end
  end
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sharshenov/minimagick-clip.

License

The gem is available as open source under the terms of the MIT License.