Php checks the main color of an image. This article describes how php detects the main color of an image. Share it with you for your reference. The specific implementation method is as follows :? 12345678910 php method for detecting major Image colors
This article describes how php detects the main color of an image. Share it with you for your reference. The specific implementation method is as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$ I = imagecreatefromjpeg ("image.jpg "); For ($ x = 0; $ x For ($ y = 0; $ y $ Rgb = imagecolorat ($ I, $ x, $ y ); $ R = ($ rgb> 16) & 0xFF; $ G = ($ rgb >>& 0xFF; $ B = $ rgb & 0xFF; $ RTotal + = $ r; $ GTotal + = $ g; $ BTotal + = $ B; $ Total ++; } } $ RAverage = round ($ rTotal/$ total ); $ GAverage = round ($ gTotal/$ total ); $ BAverage = round ($ bTotal/$ total ); |
I hope this article will help you with php programming.
Examples in this article describes how php detects the main color of an image. Share it with you for your reference. The specific implementation method is as follows :? 1 2 3 4 5 6 7 8 9 10...