<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BLOGARITHMIC DISFUNCTION &#187; GD</title>
	<atom:link href="http://www.bl0g.co.uk/tag/gd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bl0g.co.uk</link>
	<description>Watching the distance between posts increase exponentially.</description>
	<lastBuildDate>Wed, 07 Jul 2010 09:44:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Creating Transparent PNG Images in GD</title>
		<link>http://www.bl0g.co.uk/20070327/creating-transparent-png-images-in-gd/</link>
		<comments>http://www.bl0g.co.uk/20070327/creating-transparent-png-images-in-gd/#comments</comments>
		<pubDate>Tue, 27 Mar 2007 13:07:51 +0000</pubDate>
		<dc:creator>DD</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WebDev]]></category>
		<category><![CDATA[GD]]></category>
		<category><![CDATA[PNG]]></category>

		<guid isPermaLink="false">http://www.bl0g.co.uk/?p=1191</guid>
		<description><![CDATA[For a project at work I had to create a true colour PNG from scratch using GD, copy a load of image files to it from various locations and then display it on-screen.
The code to create a transparent PNG turned out to be a litle complicated:
 &#60;?php
// create a true colour, transparent image
// turn blending [...]]]></description>
			<content:encoded><![CDATA[<p>For a project at work I had to create a true colour PNG from scratch using GD, copy a load of image files to it from various locations and then display it on-screen.</p>
<p>The code to create a transparent PNG turned out to be a litle complicated:</p>
<ul><kbd> &lt;?php<br />
// create a true colour, transparent image<br />
// turn blending OFF and draw a background rectangle in our transparent colour<br />
$image=imagecreatetruecolor($iwidth,$iheight);<br />
imagealphablending($image,false);<br />
$col=imagecolorallocatealpha($image,255,255,255,127);<br />
imagefilledrectangle($image,0,0,$iwidth,$iheight,$col);<br />
imagealphablending($image,true);<br />
// ^^ Alpha blanding is back on.<br />
</kbd></ul>
<ul><kbd> // insert image manipulation stuff in here</p>
<p>// output the results...<br />
header("Content-Type: image/png;");<br />
imagealphablending($image,false);<br />
imagesavealpha($image,true);<br />
imagepng($image);<br />
?&gt;<br />
</kbd></ul>
<p><strong>Important Note</strong>: If you output the image direct into the document stream as this example does, the PNG fix that uses bahaviours won&#8217;t work as it&#8217;s not a true PNG.  For that, you&#8217;ll have to drop the header and give imagepng() a filename and show that file.  Seems to work fine in other browsers, however.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bl0g.co.uk/20070327/creating-transparent-png-images-in-gd/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
