Skip to content

a6b8/masked-ape-club-for-ruby

Repository files navigation

Masked Ape Club for Ruby

Let the apes out and free them from backgrounds. With the goal to bring them to context.

Examples

Create transparent background

require 'masked_ape_club'

id = #your ape id
a = MaskedApeClub::Load.new()
a.load( id: id )
a.mask()
a.write( path: 'test.png' )

Censor your ape

require 'masked_ape_club'

id = #your ape id
a = MaskedApeClub::Load.new()
a.load( id: id )
a.censored()
a.write( path: 'test.png' )

Go on holiday with your ape!

require 'masked_ape_club'

id = #your ape id
a = MaskedApeClub::Load.new()
a.load( id: id )
a.mask()

background = 'background.png'
blob = open( background ).read()
a.background( blob: blob )
a.write( path: 'test.png' )


Table of Contents
  1. Quickstart
  2. Setup
  3. Methods
  4. Contributing
  5. Limitations
  6. Credits
  7. License
  8. Code of Conduct
  9. Support my Work


Quickstart
gem install masked_ape_club
require 'masked_ape_club'

id = #your ape id
a = MaskedApeClub::Load.new()
a.load( id: id )
a.mask_ape( id: id)
a.write( path: 'your_ape.png' )


Setup

Add this line to your application's Gemfile:

gem 'masked_ape_club'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install masked_ape_club

On Rubygems:



Methods

.load( id: )

require 'masked_ape_club'

id = #your ape id
a = MaskedApeClub::Load.new()
a.load( id: id )
a.write( path: 'test.png' )

Input

Key Type Required Example Description
:id String Yes your ape number Choose your ape.

Return
True

.mask( fuzz: '1%', position: 1500, radius: 25 )

require 'masked_ape_club'

id = #your ape id
a = MaskedApeClub::Load.new()
a.load( id: id )
a.mask()
a.write( path: 'test.png' )

Input

Key Type Required Example Description
:fuzz String No "1%" Choose threshold for erasing background, dont forget "%"
:position Integer No 1500 Set pixel index which represent the background color. Every Image has 631x631 Pixels, 1500 should be near on the left right in row 3.
:size Integer No 2 Draws a small frame arround the image, for better result on keying the background.

Return
True

.censored( upper_left_x: 240, upper_left_y: 210, lower_right_x: 460, lower_right_y: 270, color: 'black' )

require 'masked_ape_club'

id = #your ape id
a = MaskedApeClub::Load.new()
a.load( id: id )
a.censored()
a.write( path: 'test.png' )

Input

Key Type Required Example Description
:upper_left_x Integer No 240 Set rectangle coordinate.
:upper_left_y Integer No 210 Set rectangle coordinate.
:lower_right_x Integer No 460 Set rectangle coordinate.
:lower_right_y Integer No 270 Set rectangle coordinate.
:color Integer No 'black' Set background color of rectangle

Return
True

.background( blob:, gravity: Magick::CenterGravity, offset_x: 0, offset_y: 0, width: 631, height: 631)

require 'masked_ape_club'

id = #your ape id
a = MaskedApeClub::Load.new()
a.load( id: id )
a.mask()

background = 'background.png'
blob = open( background ).read()
a.background( blob: blob )
a.write( path: 'test.png' )

Input

Key Type Required Example Description
:blob String Yes Set rectangle coordinate.
:gravity RMagick Constant No 210 See RMagick documentation for details: RMagick Gravity
:offset_x Integer No 0 Offset ape on the x axes.
:offset_y Integer No 0 Offset ape on the y axes.
:width Integer No 631 Set default canvas width
:height Integer No 631 Set default canvas height

Return
True


Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/a6b8/masked-ape-club-for-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

Limitations
  • Only tested with some ape


Credits

License

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

Code of Conduct

Everyone interacting in the masked-ape-club-for-ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Star Us

Please ⭐️ star this Project, every ⭐️ star makes us very happy!

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages