Socket
Book a DemoInstallSign in
Socket

ruby_randimage

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ruby_randimage

0.0.4
bundlerRubygems
Version published
Maintainers
3
Created
Source

RubyRandimage

Build Status Coverage Status Code Climate security

Are you looking for an amazing avatar generator for your website users? ruby_randimage is your gem!

A powerful, customizable and sophisticated awesome SVG avatars generator from several options such as symmetries, size, color palette and color densities.

RubyRandimage is a pure Ruby library without any dependencies.

Demo App

We have implemented a demo app for you to try out: Demo App

Here is the repository: https://github.com/camumino/ruby_randimage_demoapp

Installation

Add this line to your application's Gemfile:

gem 'ruby_randimage'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ruby_randimage

Usage

Create a random svg image saved on the file system.

RubyRandimage.create_and_save_file("ruby_randimage.svg")

Create a random svg image String

svg = RubyRandimage.create

Returned String can be used in a simple way in your HTML document settting a size for your image

<img src="data:image/svg+xml;utf8, <%= raw(svg) %>" width="200px">

Customizing your random svg image

Random svg image can be customized setting the following options:

title: (String) SVG <title> tag for image. Example: "awesome_avatar"
colors: (Array) colors to compose your image, Example: ["#aaaaaa", "#990000"] or ["#aaa", "#900"].
symmetry_axes: (Array).
    - No symmetry: [false, false]
    - X symmetry: [true, false]
    - Y symmetry: [false, true]
    - Full symmetry: [true, true]
num_cells: (Fixnum) Number of rows and columns in the image. Min: 2, Max:16
seed: (Fixnum) seed to set random numbers.

Examples

svg = RubyRandimage.create( title: "ruby rand image", num_cells: 8, colors: ["#fff", "f00"], symmetry_axes: [true, true])

Colors tip: You can define each color density setting the same color multiple times. For example to create an image with aproximately 75% white cells and 25% red cells you can do:

svg = RubyRandimage.create( title: "ruby rand image", num_cells: 8, colors: ["#fff", "#fff", "#fff", "f00"], symmetry_axes: [true, true])

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/santiriera626/ruby_randimage. 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.

FAQs

Package last updated on 30 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.