<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Unable to save to png..</title>
		<link>http://www.allegro.cc/forums/view/615231</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 02 Apr 2015 07:41:38 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello,</p><p>Got a problem, When I call al_save_bitmap(&quot;something.bmp&quot;, myimage); it saves my image to a bmp file no problem. But when I try al_save_bitmap(&quot;something.png&quot;, myimage); I get a .png file with 0 bytes.. </p><p>My code has al_init_image_addon() so I don&#39;t know why I cant save to .png. Would be nice if I could as .png is more memory efficient. Thanks
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (devo_au)</author>
		<pubDate>Sun, 29 Mar 2015 19:37:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What OS and Allegro version are you using?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Mon, 30 Mar 2015 01:06:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Allegro v 5.10<br />Windows 8 64
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (devo_au)</author>
		<pubDate>Mon, 30 Mar 2015 19:39:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That sounds like you&#39;ve compiled it yourself. If so, try recompiling with <span class="source-code">cmake <span class="k3">-</span>DWANT_NATIVE_IMAGE_LOADER<span class="k3">=</span>off ..</span> . This will turn off the native loaders and force Allegro to use libpng.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Mon, 30 Mar 2015 20:55:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Sorry my bad, im using 5.0.10. I didn&#39;t have to compile it, just put the files into the directories and off I went.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (devo_au)</author>
		<pubDate>Tue, 31 Mar 2015 06:02:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh, nvm. Where did you get these binaries? I&#39;m going to try to reproduce this.</p><p>EDIT: Trying things out with the MinGW 4.7 binaries from a.cc, this program works fine for me:</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;allegro5/allegro.h&gt;</span>
<span class="p">#include &lt;allegro5/allegro_image.h&gt;</span>

<span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="k2">{</span>
  <a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/al_init_image_addon"><span class="a">al_init_image_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a><span class="k3">*</span> bmp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_bitmap"><span class="a">al_create_bitmap</span></a><span class="k2">(</span><span class="n">256</span>, <span class="n">256</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/al_set_target_bitmap"><span class="a">al_set_target_bitmap</span></a><span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/al_clear_to_color"><span class="a">al_clear_to_color</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/al_map_rgb_f"><span class="a">al_map_rgb_f</span></a><span class="k2">(</span><span class="n">1</span>, <span class="n">0</span>.<span class="n">2</span>, <span class="n">0</span>.<span class="n">5</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
  <a href="http://www.allegro.cc/manual/al_save_bitmap"><span class="a">al_save_bitmap</span></a><span class="k2">(</span><span class="s">"test.png"</span>, bmp<span class="k2">)</span><span class="k2">;</span>
  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

One last thing to try would be to link in the debug version and look at the allegro.log. In there, if Allegro is using the libpng backend, you should hopefully see some lines starting with &quot;PNG error&quot;.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Tue, 31 Mar 2015 08:23:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just tried your code with VC++ 2010 express in a new project. <br />It worked :/<br />It created the 256 x 256 magenta square png file..<br />Ran my original code again, with .png extention, still creates <br />0 byte png files. Checked allegro.log, all i found is relating to .png is<br /> [  24.22865] Failed loading help.png with .png handler.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (devo_au)</author>
		<pubDate>Tue, 31 Mar 2015 17:15:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s very puzzling... it seems that in your program you can&#39;t even <i>load</i> PNGs! Something&#39;s very wrong. I don&#39;t quite understand how the test program can work while your program doesn&#39;t though... are you linking to the same libraries and have the same DLLs in the same place? Clearly, <span class="source-code"><a href="http://www.allegro.cc/manual/al_init_image_addon"><span class="a">al_init_image_addon</span></a></span> does something, since that error message only comes up if it was at least partly successful (as it managed to register the .png handler).</p><p>Sorry about this... the debugability of the IO routines has always been a pain point.</p><p>How big is your project? Is it an option for you to share the source?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Tue, 31 Mar 2015 20:56:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Unfortunately I cant post the project, it is big and has a lot of art that isn&#39;t my own in it. I have been experimenting with it though. I pasted your code into the project and run it. It created a png file of the same dimensions but it had no color this time.. Don&#39;t know if that means anything.</p><p>I have tried to replicate the problem in another project, but your code works in perfectly every time so far. I&#39;m stuffed if I know what&#39;s going on. Might just give up and go with the bmp output or maybe batch convert to png.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (devo_au)</author>
		<pubDate>Thu, 02 Apr 2015 07:41:38 +0000</pubDate>
	</item>
</rss>
