MagickFilter
A powerful yet very simple to use gem to apply all sorts of cool instagram types of filters to your images or photos in your Ruby on Rails application. With this gem you can use all sorts of filters like Poster, Sepia, Navy, Sketch etc. You can apply frames of different types of frames with different colours to your images or photos as well.
This Gem is an attempt to build Ruby Gem and release it to rubygems.org. Latest version of this gem allows you to add frame to existing photo. This Gem is in early stage. I'll keep on adding some more filters and features with time.
This Gem is based on Image Magick, So please make sure that you have image magick installed on your system.
Installation
Add this line to your application's Gemfile:
gem 'magick_filter'
And then execute:
$ bundle
Or install it yourself as:
$ gem install magick_filter
Usage
Latest version of this Gem supports adding frames to photo with different colors. You can choose any desired color for frame from ImageMagick color list
MagickFilter::Tool.apply_frame(image_path, frame_color, frame_type)
a) Option 1st => Basic Frame MagickFilter::Tool.apply_frame(image_path, "snow", "basic") b) Option 2nd => Sunken Frame MagickFilter::Tool.apply_frame(image_path, "snow", "sunken")
Different color options example - a) MagickFilter::Tool.apply_frame(image_path, "snow", "basic") b) MagickFilter::Tool.apply_frame(image_path, "LightPink", "BASIC") c) MagickFilter::Tool.apply_frame(image_path, "SlateBlue1", :basic)
Default frame type is "basic", frame_type is case insensitive. You can add "basic", "BASIC" or :basic
In present there are 12 filters available in this Gem. Use the given below commands ( from Filter Examples section ) on console to convert photos.
MagickFilter::Tool.process(image_path, filter_type)
a) MagickFilter::Tool.process(image_path, "sketch") b) MagickFilter::Tool.process(image_path, "BRIGHT") c) MagickFilter::Tool.process(image_path, :sepia) d) MagickFilter::Tool.process(image_path, "rough")
Filter type is case insensitive, you can add "sketch", "SKETCH" or :sketch
Frame Examples
Original Image
Snow Color Frame with basic frame
MagickFilter::Tool.apply_frame(image_path, "snow", "basic")
LightPink Color Frame with sunken frame
MagickFilter::Tool.apply_frame(image_path, "LightPink", "sunken")
Orchid1 Color Frame with basic frame
MagickFilter::Tool.apply_frame(image_path, "orchid1", "basic")
SlateBlue1 Color Frame with sunken frame
MagickFilter::Tool.apply_frame(image_path, "SlateBlue1", "sunken")
SlateGray4 Color Frame
MagickFilter::Tool.apply_frame(image_path, "SlateGray4")
DeepSkyBlue Color Frame
MagickFilter::Tool.apply_frame(image_path, "DeepSkyBlue")
SpringGreen4 Color Frame
MagickFilter::Tool.apply_frame(image_path, "SpringGreen4")
Gold2 Color Frame
MagickFilter::Tool.apply_frame(image_path, "gold2")
Filter Examples
Original Image
Sketch Filter
MagickFilter::Tool.process(image_path, "sketch")
Gold Filter
MagickFilter::Tool.process(image_path, "gold")
Poster Filter
MagickFilter::Tool.process(image_path, "poster")
Bright Filter
MagickFilter::Tool.process(image_path, "bright")
Black & White Filter
MagickFilter::Tool.process(image_path, "bw")
Peach Filter
MagickFilter::Tool.process(image_path, "peach")
Navy Filter
MagickFilter::Tool.process(image_path, "navy")
Firebrick Filter
MagickFilter::Tool.process(image_path, "firebrick")
Contrast Filter
MagickFilter::Tool.process(image_path, "contrast")
Poster2 Filter
MagickFilter::Tool.process(image_path, "poster2")
Rough Filter
MagickFilter::Tool.process(image_path, "rough")
Sepia Filter
MagickFilter::Tool.process(image_path, "sepia")
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/arvind02/magick_filter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the MagickFilter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.