<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] How to load an image from memory ?</title>
		<link>http://www.allegro.cc/forums/view/613273</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 18 Sep 2013 21:20:31 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello,</p><p>I&#39;m in a situation where speed is very important. I&#39;m analyzing a continuous stream of images that are in memory. What I want to do is: load and image into a bitmap, analyse it pixel-per-pixel, and do other stuff...</p><p>Well, I&#39;m here because I&#39;m stuck with the first part...</p><p>So, Could anyone tell me How to load an image that &quot;sits&quot; in memory?</p><p>Also, any future recommendations on pixel-per-pixel analysis is also appreciated. Particularly, What functions should one use for the process to be fast.</p><p>Any Help Appreciated.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kakadas)</author>
		<pubDate>Wed, 18 Sep 2013 20:27:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>al_load_bitmap() loads an image into memory:</p><p><span class="source-code"><a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a> <span class="k3">*</span>my_image <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_bitmap"><span class="a">al_load_bitmap</span></a><span class="k2">(</span><span class="s">"image.png"</span><span class="k2">)</span><span class="k2">;</span></span></p><p>You can use al_get_pixel() to read each individual pixel in a nested loop, but it&#39;s going to be SLOW... make sure you lock the bitmap before doing so (it will speed it up a bit):</p><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_lock_bitmap"><span class="a">al_lock_bitmap</span></a><span class="k2">(</span>my_image, <a href="http://www.allegro.cc/manual/al_get_bitmap_format"><span class="a">al_get_bitmap_format</span></a><span class="k2">(</span>my_image<span class="k2">)</span>, ALLEGRO_LOCK_READONLY<span class="k2">)</span><span class="k2">;</span></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Werwolf696)</author>
		<pubDate>Wed, 18 Sep 2013 21:00:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can open a chunk of memory using the <span class="source-code"><a href="http://www.allegro.cc/manual/al_open_memfile"><span class="a">al_open_memfile</span></a></span> function from the memfile addon. then you can use the <span class="source-code"><a href="http://www.allegro.cc/manual/al_load_bitmap_f"><span class="a">al_load_bitmap_f</span></a></span> function to load the image from an open file handle.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 18 Sep 2013 21:18:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank You Very Much Thomas Fjellstrom. I don&#39;t know what I would do without You!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kakadas)</author>
		<pubDate>Wed, 18 Sep 2013 21:20:31 +0000</pubDate>
	</item>
</rss>
