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
| require 'RMagick' | |
| TOP_N = 10 # Number of swatches | |
| # Create a 1-row image that has a column for every color in the quantized | |
| # image. The columns are sorted decreasing frequency of appearance in the | |
| # quantized image. | |
| def sort_by_decreasing_frequency(img) | |
| hist = img.color_histogram | |
| # sort by decreasing frequency |
NewerOlder