All Projects → nazarhussain → camalian

nazarhussain / camalian

Licence: MIT license
Library used to deal with colors and images. You can extract colors from images.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to camalian

sourcerer
read code like a wizard. a 16bit color scheme for hackers
Stars: ✭ 136 (+202.22%)
Mutual labels:  colors
golden-colors
Generate random colors using Golden ratio conjugate
Stars: ✭ 16 (-64.44%)
Mutual labels:  colors
concolor
Colouring template strings using tags with annotations 🎨
Stars: ✭ 35 (-22.22%)
Mutual labels:  colors
Crayons.jl
Colored and styled strings for terminals.
Stars: ✭ 115 (+155.56%)
Mutual labels:  colors
nvim-highlite
A colorscheme template that is "lite" on logic for the developer.
Stars: ✭ 163 (+262.22%)
Mutual labels:  colors
Stochastic-Quantization
Training Low-bits DNNs with Stochastic Quantization
Stars: ✭ 70 (+55.56%)
Mutual labels:  quantization
pystyle
The source of my Python library, pystyle.
Stars: ✭ 158 (+251.11%)
Mutual labels:  colors
hex-rgba
Convert HEX to RGBA
Stars: ✭ 12 (-73.33%)
Mutual labels:  colors
magento-grid-colors
Magento 2 Grid Colors module for colorizing admin grids. Supports saving of states with the help of grid's bookmarks.
Stars: ✭ 54 (+20%)
Mutual labels:  colors
pantone-colors
Hex values of all 2310 Pantone colors
Stars: ✭ 147 (+226.67%)
Mutual labels:  colors
oof
Convenient, high-performance RGB color and position control for console output
Stars: ✭ 764 (+1597.78%)
Mutual labels:  colors
color-math
Expressions to manipulate colors.
Stars: ✭ 18 (-60%)
Mutual labels:  colors
PlantUML-colors
This script is to show all named color suggested by PlantUML
Stars: ✭ 52 (+15.56%)
Mutual labels:  colors
md-colors
Material design color palettes as an npm package
Stars: ✭ 12 (-73.33%)
Mutual labels:  colors
ATMC
[NeurIPS'2019] Shupeng Gui, Haotao Wang, Haichuan Yang, Chen Yu, Zhangyang Wang, Ji Liu, “Model Compression with Adversarial Robustness: A Unified Optimization Framework”
Stars: ✭ 41 (-8.89%)
Mutual labels:  quantization
colorgrab
A cross-platform color picker
Stars: ✭ 80 (+77.78%)
Mutual labels:  colors
go-rainbow
Golang Helper for beautiful CLI Applications
Stars: ✭ 86 (+91.11%)
Mutual labels:  colors
DNNAC
All about acceleration and compression of Deep Neural Networks
Stars: ✭ 29 (-35.56%)
Mutual labels:  quantization
pngquant
A Python Wrapper of Pngquant
Stars: ✭ 27 (-40%)
Mutual labels:  quantization
anypalette.js
🎨 Read/write all color palette file formats ❤🧡💛💚💙💜
Stars: ✭ 41 (-8.89%)
Mutual labels:  colors

Camalian

Gem Version Ruby Maintainability

Ruby gem to extract color palettes from images and play with their saturation

Installation

Add this line to your application's Gemfile:

gem 'camalian', '~> 0.2.0'

And then execute:

$ bundle

Or install it yourself as:

$ gem install camalian

Usage

image = Camalian::load('file_path')
colors = image.prominent_colors(15)
colors = colors.sort_similar_colors
colors.light_colors(0, 40)

You can find a working example with detail explanation and reference code here on this link. Here we will build a functional color based image search engine in Ruby on Rails.

NOTE: Since its a compute intensive operation so for production use its suggested to use under a background job and not within a request/response cycle.

Quantization Algorithms

Currently following algorithms are implemented.

Histogram

Its a most common algorithm for color quantization and used different bucket technique to group the colors together. You can read more about this technique here. It can be accessed by Camalian::QUANTIZATION_HISTOGRAM constant. This is used as default method as well.

K Means

This algorithm uses color distancing in RGB space to group the similar colors. You can learn more about this technique here. It can be accessed by Camalian::QUANTIZATION_K_MEANS constant.

Median Cut

This algorithm uses color highest color range to determine the median and split colors to groups. The output consists of average color of such color groups. Since these algorithm don't use actual colors and instead average, so you will may not exact matching pixel in the image. This algorithm is nice to be used with image compression, where similarity and compression is important than having same pixel colors. You can learn more about this technique here . It can be accessed by Camalian::QUANTIZATION_MEDIAN_CUT constant.

You can set default quantization method globally as:

Camalian.options[:quantization] = Camalian::QUANTIZATION_K_MEANS

or you can set at the time of extracting colors by.

image = Camalian::load('file_path')
colors = image.prominent_colors(15, quantization: Camalian::QUANTIZATION_K_MEANS)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].