<?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>WS-Blog &#187; Alchemy</title>
	<atom:link href="http://www.websector.de/blog/category/alchemy/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.websector.de/blog</link>
	<description>// Flex, AIR, Flash</description>
	<lastBuildDate>Wed, 16 Jun 2010 09:25:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Speed up JPEG encoding using Alchemy</title>
		<link>http://www.websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/</link>
		<comments>http://www.websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 15:16:42 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[Alchemy]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/?p=287</guid>
		<description><![CDATA[Few weeks ago Thibault Imbert published an optimized version of Adobes JPGEncoder. And it rocks! However, if you may have very big-size bitmaps it takes too much time to encode images. For example: A bitmap with a size of 2000px x 1500px takes 22 sec. (BTW: Adobes version 30 sec.!!) Today I came across to [...]]]></description>
			<content:encoded><![CDATA[<p>Few weeks ago <a href="http://www.bytearray.org/">Thibault Imbert</a> published an <a href="http://www.bytearray.org/?p=775">optimized version</a> of <a href="http://code.google.com/p/as3corelib/">Adobes JPGEncoder</a>. And it rocks! However, if you may have very big-size bitmaps it takes too much time to encode images. For example: A bitmap with a size of 2000px x 1500px takes 22 sec. (BTW: Adobes version 30 sec.!!) </p>
<p>Today I came across to a <a href="http://manfred.dschini.org/2008/11/21/alchemy-jpeg-encoder/">post by Manfred Weber</a>, which points to a discussion at <a href="http://forums.adobe.com/community/labs/alchemy">Adobes Alchemy forum</a>. There you will find <a href="http://forums.adobe.com/message/987186">a great solution</a> published by <a href="http://metal.hurlant.com/blog/">metalbot</a> for encoding JPEGs using <a href="http://labs.adobe.com/technologies/alchemy/">Alchemy</a>. It&#8217;s based on a <a href="http://www.ijg.org/files/">C library</a> for JPEG image compression by <a href="http://www.ijg.org/">IJG</a> and it&#8217;s pretty fast (2,7 sec. for 2000 px x 1500px ) !!! Check out the example:</p>
<p><span id="more-287"></span></p>
<h2>Example</h2>
<p>Click the image to see the live example. Feel free to post a comment about your your results!</p>
<p><a href="http://www.websector.de/blog/wp-content/uploads/2009/06/21/AlchemyJPEGEncoder.html"><img src="http://www.websector.de/blog/wp-content/uploads/2009/06/21/screen_testAlchemyJPEGEncoder.jpg" alt="Screen shot" /></a></p>
<h2>Download Full Source</h2>
<p>I have changed  the <a href="http://hurlant.com/as3_encoder_jpeg.tgz ">original C code</a> a little bit for manipulating the quality of an encoded image as well. It&#8217;s just one line added to &#8220;as3_jpeg_wrapper.gg&#8221; (line 78) <code>jpeg_set_quality(&#038;cinfo, quality, TRUE /* limit to baseline-JPEG values */);</code> Therefore the &#8220;as3_jpeg_wrapper.swc&#8221; located within the *.zip is recompiled for using this feature in your Flex project via  <code>as3_jpeg_wrapper.write_jpeg_file(baSource, WIDTH, HEIGHT, 3, 2, quality);</code> </p>
<p>Full source of the Flex based example above: <a href="http://www.websector.de/blog/?download=AlchemyJPEGEncoderFlexExample">AlchemyJPEGEncoderFlexExample.zip</a> (Downloads: 1576)</p>
<p>BTW: You will find the original source of all C based classes published by metalbot <a href="http://forums.adobe.com/message/987186#987186">here</a>.  </p>
<h2>Tips</h2>
<p>I struggled around to set up Alchemy and to recompile the IJG library and the &#8220;as3_jpeg_wrapper.swc&#8221;. To avoid this, here are some tips:</p>
<ul>
<li><a href="http://www.zeropointnine.com/wiki/index.php?n=FlashPlatform.Alchemy">Instruction for set up Alchemy</a> by <a href="http://www.zeropointnine.com/blog/">Lee Felarca</a>   (zeropointnine). Best instruction I&#8217;ve found so far for set up Alchemy.</li>
<li>Recompiling the SWC of metalbot&#8217;s source following its &#8220;README.txt&#8221; and using its &#8220;Makefile&#8221; failed: To avoid this issue, after compiling the C library of jpegsrc you have to move the following files to $ALCHEMY_HOME/jpeg/ as well: &#8220;jconfig.h&#8221;, &#8220;jmorecfg.h&#8221; and &#8220;jpeglib.h&#8221;. Check out <a href="http://forums.adobe.com/message/1059134#1059134">the comment by notnick here</a></li>
</ul>
<p><strong>[UPDATE 06/22/09]</strong> There is another great test for encoding images using Alchemy by <a href="http://segfaultlabs.com/">Mateusz Malczak</a>, which includes an asynchrounous example as well: <a href="http://segfaultlabs.com/blog/post/asynchronous-jpeg-encoding">Alchemy &#8211; asynchronous jpeg encoding</a> Thanks to <a href="http://twitter.com/xoestudio">xoestudio</a> for pointing to this via twitter! <strong>[UPDATE] </strong></p>
<p>Have fun <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>-Jens</p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>
