{"id":541,"date":"2010-03-08T17:40:53","date_gmt":"2010-03-08T16:40:53","guid":{"rendered":"http:\/\/www.dotmana.com\/index.php\/?p=541"},"modified":"2010-03-08T17:41:00","modified_gmt":"2010-03-08T16:41:00","slug":"php-imagick-black-background-gif-transparency","status":"publish","type":"post","link":"https:\/\/www.dotmana.com\/weblog\/2010\/03\/php-imagick-black-background-gif-transparency\/","title":{"rendered":"PHP Imagick black background gif transparency"},"content":{"rendered":"<p>If you want to put a white background instead of black background, add this piece of code :<\/p>\n<blockquote><p>$path_parts = pathinfo($file);<br \/>\nif ($path_parts[&#8216;extension&#8217;]==&#8217;gif&#8217;)<br \/>\n{<br \/>\n$img = imagecreatefromgif($file);<br \/>\n$imgr = imagecreatetruecolor($neww, $newh);<br \/>\n$bgc = imagecolorallocate ($imgr, 255, 255, 255);<br \/>\nimagefilledrectangle ($imgr, 0, 0, $neww, $newh, $bgc);<\/p>\n<p>imagecopyresampled($imgr, $img, 0, 0, 0, 0, $neww, $newh, $pixw, $pixh);<br \/>\n}<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>If you want to put a white background instead of black background, add this piece of code : $path_parts = pathinfo($file); if ($path_parts[&#8216;extension&#8217;]==&#8217;gif&#8217;) { $img = imagecreatefromgif($file); $imgr = imagecreatetruecolor($neww, $newh); $bgc = imagecolorallocate ($imgr, 255, 255, 255); imagefilledrectangle ($imgr, &hellip; <a href=\"https:\/\/www.dotmana.com\/weblog\/2010\/03\/php-imagick-black-background-gif-transparency\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-541","post","type-post","status-publish","format-standard","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/comments?post=541"}],"version-history":[{"count":2,"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/posts\/541\/revisions"}],"predecessor-version":[{"id":543,"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/posts\/541\/revisions\/543"}],"wp:attachment":[{"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/media?parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/categories?post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/tags?post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}