项目作者: bachors

项目描述 :
PHP Extract Image Color Class
高级语言: PHP
项目地址: git://github.com/bachors/PHP-Extract-Image-Color-Class.git
创建时间: 2017-04-16T09:26:25Z
项目社区:https://github.com/bachors/PHP-Extract-Image-Color-Class

开源协议:MIT License

下载


PHP-Extract-Image-Color-Class

PHP Extract Image Color Class a library to extract the color from internal or external image.

LIVE DEMO

USAGE:

  1. path('img/test.jpg'); // show all colors
  2. print_r($color1);
  3.  
  4. // external image
  5. $color2 = $image->url('http://host.com/image/cat.jpg', $number); // show 5 colors
  6. print_r($color2);
  7.  
  8. ?>

RESULT:

  1. Array
  2. (
  3. [status] => success
  4. [data] => Array
  5. (
  6. [0] => Array
  7. (
  8. [hex] => 5cffbe
  9. [rgb] => Array
  10. (
  11. [0] => 92
  12. [1] => 255
  13. [2] => 190
  14. )
  15.  
  16. [percentage] => 59.893621672784
  17. )
  18.  
  19. [1] => Array
  20. (
  21. [hex] => 00bcd5
  22. [rgb] => Array
  23. (
  24. [0] => 0
  25. [1] => 188
  26. [2] => 213
  27. )
  28.  
  29. [percentage] => 10.686443707707
  30. )
  31.  
  32. [2] => Array
  33. (
  34. [hex] => ffee4e
  35. [rgb] => Array
  36. (
  37. [0] => 255
  38. [1] => 238
  39. [2] => 78
  40. )
  41.  
  42. [percentage] => 10.623686667473
  43. )
  44.  
  45. [3] => Array
  46. (
  47. [hex] => 0096a5
  48. [rgb] => Array
  49. (
  50. [0] => 0
  51. [1] => 150
  52. [2] => 165
  53. )
  54.  
  55. [percentage] => 1.660489556354
  56. )
  57.  
  58. [4] => Array
  59. (
  60. [hex] => ffffff
  61. [rgb] => Array
  62. (
  63. [0] => 255
  64. [1] => 255
  65. [2] => 255
  66. )
  67.  
  68. [percentage] => 1.5794712462159
  69. )
  70.  
  71. [5] => Array
  72. (
  73. [hex] => ffee4c
  74. [rgb] => Array
  75. (
  76. [0] => 255
  77. [1] => 238
  78. [2] => 76
  79. )
  80.  
  81. [percentage] => 0.5421796754638
  82. )
  83.  
  84. [6] => Array
  85. (
  86. [hex] => ff5152
  87. [rgb] => Array
  88. (
  89. [0] => 255
  90. [1] => 81
  91. [2] => 82
  92. )
  93.  
  94. [percentage] => 0.50359952777899
  95. )
  96.  
  97. [7] => Array
  98. (
  99. [hex] => 5d5d5d
  100. [rgb] => Array
  101. (
  102. [0] => 93
  103. [1] => 93
  104. [2] => 93
  105. )
  106.  
  107. [percentage] => 0.3958323152461
  108. )
  109.  
  110. )
  111.  
  112. )