This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Keybase proof | |
| I hereby claim: | |
| * I am melaniegershman on github. | |
| * I am melaniegershman (https://keybase.io/melaniegershman) on keybase. | |
| * I have a public key ASBQS3E28FgY2i-yR3gpFFZIAG16QVyaWnCDUWuhAHgyXwo | |
| To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def collect_images(number_of_images) | |
| number_of_images.times do |image| | |
| pixels = [] | |
| freq = Hash.new(0) | |
| img = Magick::ImageList.new('app/assets/images/' + image + '.jpg') | |
| img.each_pixel {|pixel| pixels << pixel } | |
| colors = pixels.map {|pixel| pixel.to_color} | |
| colors.each {|color| freq[color] += 1} | |
| freq = freq.sort_by {|color, frequency| frequency }.reverse |