A constructor for extracting colors from images written in Java. Quickly retrieve common and prominent colors from images.
via Frida Lannerström on Unsplash
Result | Tolerance | |
---|---|---|
Prominent | 80 | |
Common | 1 |
// Create the constructor.
Brilliance brilliance = new Brilliance()
// Image to search; String, URL, BufferedImage.
.image("https://images.unsplash.com/photo-1678285624327-3ec8a48e1609?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8")
// How much gray-tone a pixel can have. (1 = most common color, higher = more prominent)
.grayTolerance(80)
// Quality of the blocking/splitting of the image. 1 is the highest quality.
.quality(1)
// Include all pixels in the search.
.includeGray(false)
// Speed at which the gray tolerance will chunk in the while loop when a color is null.
.speed(2)
// Automatically scales the quality setting the higher the image pixel count.
.scale(true)
// Log statistics from the color search.
.log(true);
// Build the constructor.
Color color = brilliance.build();
- Improvements to documentation.
- Gradle repo