{"id":548,"date":"2006-06-09T00:19:07","date_gmt":"2006-06-08T22:19:07","guid":{"rendered":"http:\/\/frenchfragfactory.net\/ozh\/archives\/2006\/06\/09\/php-gd-imagecolorallocate-limitation\/"},"modified":"2006-06-09T00:19:07","modified_gmt":"2006-06-08T22:19:07","slug":"php-gd-imagecolorallocate-limitation","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2006\/06\/php-gd-imagecolorallocate-limitation\/","title":{"rendered":"PHP GD : imagecolorallocate() Limitation"},"content":{"rendered":"<p>Did you know it ? PHP GD&#39;s <a href=\"http:\/\/www.php.net\/imagecolorallocate\">imagecolorallocate()<\/a> can only allocate 255 colors in a palette based image created by imagecreate() (no such limitation when you use function imagecreatetruecolors() by the way).<\/p>\n<p>This sounds pretty stupid as well as rather undocumented, but anyway, here is a new version of my <a href=\"http:\/\/planetozh.com\/blog\/my-projects\/images-php-gd-gradient-fill\/\">GD Gradient Fill<\/a> PHP class, which now produces correct colors for images larger than 256 pixels (hence containing gradients with more than 256 colors)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Did you know it ? PHP GD&#39;s imagecolorallocate() can only allocate 255 colors in a palette based image created by imagecreate() (no such limitation when you use function imagecreatetruecolors() by the way). This sounds pretty stupid as well as rather undocumented, but anyway, here is a new version of my GD Gradient Fill PHP class, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[2,146,10],"class_list":["post-548","post","type-post","status-publish","format-standard","hentry","tag-code","tag-gd","tag-php"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=548"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/548\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}