Find colors and generate palette. So you can show palette and search models by color
Add this line to your application's Gemfile:
gem 'colorcake'
And then execute:
$ bundle
Or install it yourself as:
$ gem install colorcake
-
Run rails generate colorcake:install to install initializer.
-
Add to your model include and method
image_path_for_color_generator
model should have character fieldpalette
class Photo include Colorable
def image_path_for_color_generator image.big.path end
end
Put images like 0.jpg .. 16.jpg in fixtures and run rake test
then you should see html files with generated colors and photos
- Migration files
- View examples
- Similarity search
- Color generation speed optimization
- Search speed optimization
ruby-prof test/functionals/image_generation_test.rb
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request