Objective-C version of Google Palette algorithm in Java.A tool to extract the main color of a image.Compare to traditional algorithm,iOSPalette can help you extract the main color which is more likely to be "The Main Color".It is not always the largest in pixel numbers.
For Chinese user,you can tap the article iOS图片精确提取主色调算法iOS-Palette.It will be helpul.
1.It always help you to extract the color you want,no the largest in the pixel count.Just like this case:
You can see the 6 TargetMode from the demo screenshot.They are distinguished by different Saturation and Lightness (According to HSL Color Mode).
LIGHT_VIBRANT_MODE (High Lightness , High Saturation) VIBRANT_MODE(Normal Lightness , High Saturation) DARK_VIBRANT_MODE(Dark Lightness , High Saturation) LIGHT_MUTED_MODE(High Lightness , Low Saturation) MUTED_MODE(Normal Lightness , Low Saturation) DARK_MUTED_MODE(Dark Lightness , Low Saturation)
You can get every target mode color thourgh the iOSPalette API if you need!
2.It helps to combine every single RGB Value into a VBox,then calculate the most representational color.
3.How to use iOS-Palette
You can get these simple API in Palette.h and UIImage+Palette.h:
Tips:The recommendColor is the color for the vibrant target.In case of null,It will be replaced by this order:MUTE_MODE------LIGHT_VIRANT_MODE ------LIGHT_MUTE_MODE------DARK_VIBRANT_MODE------DARK_MUTE_MODE. Absolutely,you can change the order if you want different performance.
1.Before white background:
2.In the normal illumination:
if you have any question,you can contact me thourgh the contact infomation below.Or open a issue on Github.I will solve it as soon as possible!Best wishes!