<?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>Tom Reitz &#187; rgb</title>
	<atom:link href="http://www.tom-reitz.com/tag/rgb/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tom-reitz.com</link>
	<description>Tech Talk, Catholic Commentary, and American Activism</description>
	<lastBuildDate>Mon, 05 Apr 2010 06:08:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP ICO to PNG conversion</title>
		<link>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/</link>
		<comments>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 04:24:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[ico]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[rgb]]></category>

		<guid isPermaLink="false">http://www.tom-reitz.com/?p=119</guid>
		<description><![CDATA[A few posts ago I wrote about using a PHP class to convert an ICO image to a PNG (or GIF or JPG). I just discovered a bug in the class.
I ran into a problem where some red and orange ICO images turned blue during the conversion. Reading this forum post made me realize that [...]]]></description>
			<content:encoded><![CDATA[<p><a title="ICO images in FaceBook profile boxes" href="/2009/02/09/ico-images-in-facebook-profile-boxes/" target="_self">A few posts</a> ago I wrote about using a PHP class to convert an ICO image to a PNG (or GIF or JPG). I just discovered a bug in the class.</p>
<p>I ran into a problem where some red and orange ICO images turned blue during the conversion. Reading <a title="Saving images from Flash using PHP - Colour problem!" href="http://www.flashmove.com/forum/archive/index.php/t-29133.html" target="_blank">this forum post</a> made me realize that the red and blue values were switched somewhere in <a title="PHP ICO Class" href="/wp-content/uploads/2009/02/classicophp.zip" target="_self">class.ico.php</a>. With some experimentation I found it:</p>
<p>In class.ico.php, lines 264-267 need to be changed from</p>
<pre style="font-size: 11px; width: 520px;">$c[$i] = $this-&gt;AllocateColor($im, $this-&gt;formats[$index]['colors'][$i]['red'],
         $this-&gt;formats[$index]['colors'][$i]['green'],
         $this-&gt;formats[$index]['colors'][$i]['blue'],
         round($this-&gt;formats[$index]['colors'][$i]['reserved'] / 255 * 127));</pre>
<p>to</p>
<pre style="font-size: 11px; width: 520px;">$c[$i] = $this-&gt;AllocateColor($im, $this-&gt;formats[$index]['colors'][$i]['blue'],
         $this-&gt;formats[$index]['colors'][$i]['green'],
         $this-&gt;formats[$index]['colors'][$i]['red'],
         round($this-&gt;formats[$index]['colors'][$i]['reserved'] / 255 * 127));</pre>
<p>(Note that the blue and red values are indeed switched.) After changing this, it works like a charm for me.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.tom-reitz.com%2F2009%2F02%2F17%2Fphp-ico-to-png-conversion%2F&amp;linkname=PHP%20ICO%20to%20PNG%20conversion"><img src="/wp-content/themes/organic-theme/img/share_save.gif" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.tom-reitz.com/2009/02/17/php-ico-to-png-conversion/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
