iOS开源:iOSPalette-图片精确提取主色调算法
<h2>1.介绍</h2> <p>Objective-C版本的Google Palette算法在Java.A工具中提取了一个图像的主要颜色。与传统的算法相比,iOSPalette可以帮助您提取更有可能成为“主色”的主色。它不是 总是像素数中最大的。</p> <p> </p> <h2>2.Why iOS-Palette</h2> <p>1.It always help you to extract the color you want,no the largest in the pixel count.Just like this case:</p> <p><img src="https://simg.open-open.com/show/700d2de4d609c98d8715c7ef6062620e.jpg"></p> <p>You can see the 6 TargetMode from the demo screenshot.They are distinguished by different Saturation and Lightness (According to HSL Color Mode).</p> <pre> 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)</pre> <p>You can get every target mode color thourgh the iOSPalette API if you need!</p> <p>2.It helps to combine every single RGB Value into a VBox,then calculate the most representational color.</p> <h2>3.How to use iOS-Palette</h2> <p>You can get these simple API in Palette.h and UIImage+Palette.h:</p> <p><img src="https://simg.open-open.com/show/f456ff0e880d79ebddc6d23441e79b80.jpg"></p> <p><img src="https://simg.open-open.com/show/6e6b24cbbfebcead7628d283387c0969.jpg"></p> <p>If you need all target mode info, you can use these API in Palette.h and UIImage.Palette.h: <img src="https://simg.open-open.com/show/e606380699f51b020b64f8555d717791.jpg"></p> <p>Then you all get the callback with all color infomation you want: <img src="https://simg.open-open.com/show/5711843d3af05dcbe78c1a03503018fb.jpg"></p> <pre> 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.</pre> <h2>4.Demo</h2> <p>1.Before white background:</p> <p><img src="https://simg.open-open.com/show/9a190dec313bc43a67b98c0fb5131410.jpg"></p> <p>2.In the normal illumination:</p> <p><img src="https://simg.open-open.com/show/a3bd9be014f34824f3a9b48dae23a116.jpg"></p> <h2>5.Contact me</h2> <p>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!</p> <p>项目主页:<a href="http://www.open-open.com/lib/view/home/1496969712318">http://www.open-open.com/lib/view/home/1496969712318</a></p> <p> </p> <p> </p> <p></p> <p> </p>
本文由用户 billhunter 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!