Gayner Posted November 23, 2009 Share Posted November 23, 2009 I have a image, it's a blue style off photoshop applied to a random .gif image can i use a php function or something that get's the hex color from that image only the main hex color and return it back to me so i can use it. / Quote Link to comment https://forums.phpfreaks.com/topic/182595-can-php-do-this/ Share on other sites More sharing options...
doddsey_65 Posted November 23, 2009 Share Posted November 23, 2009 do you mean you want to use the same hex color to specify background or something? if so something like PSP or GIMP tells you what the hex color is Quote Link to comment https://forums.phpfreaks.com/topic/182595-can-php-do-this/#findComment-963736 Share on other sites More sharing options...
oni-kun Posted November 23, 2009 Share Posted November 23, 2009 Use the GD library for this, it's able to decompile images but to find the 'main' hex attribute it may be a little harder, you may need to break into algorithms for that. Quote Link to comment https://forums.phpfreaks.com/topic/182595-can-php-do-this/#findComment-963746 Share on other sites More sharing options...
Gayner Posted November 23, 2009 Author Share Posted November 23, 2009 I just need t find the hex color of a image.. Quote Link to comment https://forums.phpfreaks.com/topic/182595-can-php-do-this/#findComment-963759 Share on other sites More sharing options...
oni-kun Posted November 23, 2009 Share Posted November 23, 2009 Is the image a solid colour? Quote Link to comment https://forums.phpfreaks.com/topic/182595-can-php-do-this/#findComment-963760 Share on other sites More sharing options...
iversonm Posted November 23, 2009 Share Posted November 23, 2009 Also you should check out the second sticky in php coding help. Quote Link to comment https://forums.phpfreaks.com/topic/182595-can-php-do-this/#findComment-963761 Share on other sites More sharing options...
Gayner Posted November 23, 2009 Author Share Posted November 23, 2009 Also you should check out the second sticky in php coding help. It's actually possible bro! Quote Link to comment https://forums.phpfreaks.com/topic/182595-can-php-do-this/#findComment-963770 Share on other sites More sharing options...
onlyican Posted November 23, 2009 Share Posted November 23, 2009 With PHP you can break down an image by pixel, which will give you the HEX Colour. If the image is not solid, you will need to put the image details into an array then work on the array to find the most used hex. WARNING!! Depending on the Image Size, this could be very heavy on your server and slow page loading. Please state your purpose for this. Quote Link to comment https://forums.phpfreaks.com/topic/182595-can-php-do-this/#findComment-963825 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.