No commit activity in last 3 years
No release in over 3 years
Clipping images with minimagick & mask file
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11

Runtime

 Project Readme

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.