Skip to content

sharshenov/minimagick-clip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Clipping images with minimagick & mask file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published