<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Topic: Really confused about how to create a 4444 PNG with transparency.</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/3805</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Thu, 09 Sep 2010 09:37:00 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/topic/3805" rel="self" type="application/rss+xml" />

		<item>
			<title>Questor on "Really confused about how to create a 4444 PNG with transparency."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3805#post-22810</link>
			<pubDate>Sat, 09 Jan 2010 20:02:16 +0000</pubDate>
			<dc:creator>Questor</dc:creator>
			<guid isPermaLink="false">22810@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Karl,&#60;/p&#62;
&#60;p&#62;Thanks so much, you really cleared that up for me.  &#60;/p&#62;
&#60;p&#62;Best Regards,&#60;br /&#62;
Q
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Karl on "Really confused about how to create a 4444 PNG with transparency."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3805#post-22790</link>
			<pubDate>Sat, 09 Jan 2010 08:40:12 +0000</pubDate>
			<dc:creator>Karl</dc:creator>
			<guid isPermaLink="false">22790@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;I believe the best practices guide is referring to the format of the buffer the image is loaded *into*, as in the format you want to load it as rather than the format it is stored in on disk.  4-bit is a special case, however.&#60;/p&#62;
&#60;p&#62;By setting the pixel format to RGBA4444 in cocos2d, you are telling cocos to convert every image it loads into a 16-bit image.  Cocos will ALWAYS load any image (except 4-bit) into a 32-bit buffer and then down-convert to whatever you specified.&#60;/p&#62;
&#60;p&#62;Also, if you save as 8-bit indexed, you lose your alpha channel (well, it is reduced to a 1-bit channel), and it will STILL get loaded into a 32-bit buffer and then down-converted, so you gain nothing by it.&#60;/p&#62;
&#60;p&#62;What I would recommend is: Save everything as 32-bit and run the images through an optimizer program (or make your own).  Note that optimizing will only lower the number of bytes required to store it on DISK.  If you load using kTexture2DPixelFormat_RGBA4444, for example, the final RAM usage will ALWAYS be that of a 16-bit image, and the format of the image in memory will be RGBA4444, regardless of whether the source image was 8, 16, or 32-bit, optimized or not.&#60;/p&#62;
&#60;p&#62;I'd suggest loading into your app at 16-bit until you run into RAM issues.  4-bit textures require a bit more work to use, and optimizing early usually results in wasted effort.&#60;/p&#62;
&#60;p&#62;Edit: By default, Gimp will store a PNG image in 32-bit.  With most art programs, you have to specify 8-bit if you want to save in that format.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Questor on "Really confused about how to create a 4444 PNG with transparency."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3805#post-22789</link>
			<pubDate>Sat, 09 Jan 2010 08:20:58 +0000</pubDate>
			<dc:creator>Questor</dc:creator>
			<guid isPermaLink="false">22789@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Thanks for the quick reply.&#60;/p&#62;
&#60;p&#62;I am still a little confused.  In the best Practices section of Cocos2d it says:&#60;br /&#62;
When possible, try to use 4-bit or 16-bit textures&#60;br /&#62;
   16-bit textures for PNG/GIF/BMP/TIFF images&#60;br /&#62;
   Use 32-bit textures as the last resort&#60;/p&#62;
&#60;p&#62;But if the iphone is storing images in a 32-bit buffer, and all that conversion happens for a 16bit image, why is the 32 suggested only as a last resort?&#60;/p&#62;
&#60;p&#62;Also, if I create an image in GIMP (with an alpha channel) and save it as a PNG file (without changing the mode to indexed) will that automatically save it as a 32bit image?  (What I guess I am really asking here is, how do you create a 32bit PNG image? and should I even bother moving away from 8bit).&#60;/p&#62;
&#60;p&#62;Ultimately, I have several spritesheets I would like to merge into as few as possible.  The sprites have a good deal of color variations, and if I save them as 8bit PNG, I would have to create multiple CCSpritesheets (AtlasManagers) which from what I understand may impact performance (at least I think it does).   Not too mention that I am not sure if the performance hit for several spritemanagers is worse than the performance hit for using 32 PNGs.  &#60;/p&#62;
&#60;p&#62;Which direction do you recommend I go?  Should I stick with 8bit and multiple sprite managers, go thru the hassle of trying to convert to 16bit or even go with 32bit?   &#60;/p&#62;
&#60;p&#62;Regards,&#60;br /&#62;
Q
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Karl on "Really confused about how to create a 4444 PNG with transparency."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3805#post-22787</link>
			<pubDate>Sat, 09 Jan 2010 07:57:00 +0000</pubDate>
			<dc:creator>Karl</dc:creator>
			<guid isPermaLink="false">22787@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;16-bit PNG support is spotty at best in most applications.  What I did is write a Java app that optimizes a 32-bit image so that it won't look much different when reduced to 16-bit (basically it selectively strips off 16 bits worth of information per pixel).&#60;br /&#62;
The images themselves are saved as 32-bit.  Originally I tried to save them as 16-bit, but gave up because reliable information on this subject is hard to find, and also because an optimized PNG image will compress to about the same size on disk as an equivalent 16-bit image.&#60;/p&#62;
&#60;p&#62;In Cocos2d, your image file gets loaded into a 32-bit image buffer, and then gets converted to whatever pixel format you specified.  More specifically, it gets loaded via the Apple SDK as a 32-bit image, whose pixels then get copied to a raw buffer as RGBA8888.  If you chose something other than RGBA8888 for the final format, that buffer then gets copied/converted to another buffer in the format you specified.  So if you load an image into a 16-bit format, for example, you must have 5x the 16-bit image footprint in free memory available (i.e. a 100x100 16-bit image will take 100,000 bytes to load, and 20,000 bytes thereafter).&#60;/p&#62;
&#60;p&#62;You can specify 16-bit RGB with 4-bit alpha channel like so:&#60;/p&#62;
&#60;p&#62;[Texture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA4444];
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Questor on "Really confused about how to create a 4444 PNG with transparency."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3805#post-22785</link>
			<pubDate>Sat, 09 Jan 2010 07:07:18 +0000</pubDate>
			<dc:creator>Questor</dc:creator>
			<guid isPermaLink="false">22785@http://www.cocos2d-iphone.org/forum/</guid>
			<description>&#60;p&#62;Greetings,&#60;/p&#62;
&#60;p&#62;Apologies if this is a real newbie bunch of questions, but I really tried to get search for an answer but most articles and threads I have seen don't seem to be helping me understand this. &#60;/p&#62;
&#60;p&#62;I understand the 4bit and 16bit PNG files are much faster than an 8bit png file.  However, I can't seem to figure out how to make anything BUT an 8bit PNG file.  I tried using PaintShop Pro (I have version 6) and whenever I try to save a 16bit image as a png, it says it must reduce the image to 256 colors (which to me means 8bit color).  &#60;/p&#62;
&#60;p&#62;I also tried using GIMP...  I added a transparency channel and then (according to what I could glean from a few articles I read) I used the fuzzy selector to clear out the parts of the image I want to make transparent.  Then I changed the mode to indexed...however, it then only gives me the option to have up to 256 colors again.&#60;/p&#62;
&#60;p&#62;So I am kinda banging my head against the wall.  I don't have a ton of graphics, but I have enough that 256 colors is going to make me need multiple AtlasSpriteManagers...which seems a waste simply for the sake of having more colors to use.  &#60;/p&#62;
&#60;p&#62;I have no idea if I am heading down the totally wrong road here but from what I have read it seems that PNG can have 4bits per color plus an alpha channel, which should be a 16bit image file. right?  Or am I really missing something?&#60;/p&#62;
&#60;p&#62;Any help would be greatly appreciated.  Again, apologies if this a real newbie sounding problem, but graphic design is really not my strong suit.&#60;/p&#62;
&#60;p&#62;Regards,&#60;br /&#62;
Q
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
