<?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>creatified.com &#187; Grails</title>
	<atom:link href="http://creatified.com/blog/category/development/grails/feed/" rel="self" type="application/rss+xml" />
	<link>http://creatified.com/blog</link>
	<description>code creative.</description>
	<lastBuildDate>Fri, 05 Mar 2010 15:42:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SpringSource: A Groovier Eclipse experience</title>
		<link>http://creatified.com/blog/2009/08/springsource-a-groovier-eclipse-experience/</link>
		<comments>http://creatified.com/blog/2009/08/springsource-a-groovier-eclipse-experience/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 17:48:10 +0000</pubDate>
		<dc:creator>mat.i.am</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://creatified.com/blog/?p=249</guid>
		<description><![CDATA[For a very long time developing Grails applications in Eclipse using the Groovy-Eclipse-Plugin was everything but enjoyable for me. Matthias Käppler summed it up best when he wrote:
Grails and Eclipse: Not So Groovy
In fact I struggled to get the Groovy-Eclipse-Plugin installed those days, and after finally having done that I found out that developing Grails [...]]]></description>
			<content:encoded><![CDATA[<p>For a very long time developing Grails applications in Eclipse using the Groovy-Eclipse-Plugin was everything but enjoyable for me. <a href="http://brainflush.wordpress.com/2008/05/03/grails-and-eclipse-not-so-groovy/">Matthias Käppler</a> summed it up best when he wrote:</p>
<blockquote><p>Grails and Eclipse: Not So Groovy</p></blockquote>
<p>In fact I struggled to get the Groovy-Eclipse-Plugin installed those days, and after finally having done that I found out that developing Grails applications in Eclipse was really painful for me.</p>
<p>But now with the <a href="http://blog.springsource.com/2009/07/30/a-groovier-eclipse-experience/">first pre-M1 release</a> of the next version of the Groovy-Eclipse plugin many things are better than ever. I finally got around using Grails and Eclipse for some of my projects at work but on the Mac at home I still prefer the combination of TextMate and Console.app. I&#8217;m looking forward to the final release which should improve UI performance in Eclipse, especially when using Code Assist.</p>
]]></content:encoded>
			<wfw:commentRss>http://creatified.com/blog/2009/08/springsource-a-groovier-eclipse-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grails Instruments in public SVN now</title>
		<link>http://creatified.com/blog/2009/06/grails-instruments-in-public-svn-now/</link>
		<comments>http://creatified.com/blog/2009/06/grails-instruments-in-public-svn-now/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 09:53:19 +0000</pubDate>
		<dc:creator>mat.i.am</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[flot]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Instruments]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://creatified.com/blog/?p=209</guid>
		<description><![CDATA[This weekend I've been very busy on Instruments again.
Instruments now sports a core Java library which takes care of caching the states of system usage for the last time. This is included in an all new "InstrumentsService" which will provide the necessary methods to controllers.
At the moment this is all trimmed for using flot. There are no other "export options" for now.
I decided to make this publicly available in my Subversion repository. ]]></description>
			<content:encoded><![CDATA[<p>This weekend I&#8217;ve been very busy on Instruments again.</p>
<p>Instruments now sports a core Java library which takes care of caching the states of system usage for the last time. This is included in an all new &#8220;InstrumentsService&#8221; which will provide the necessary methods to controllers.</p>
<p>At the moment this is all trimmed for using flot. There are no other &#8220;export options&#8221; for now.</p>
<p>I decided to make this publicly available in my Subversion repository. You can checkout the source tree of the Grails application here:</p>
<p><a href="http://creatified.com/svn/creatified/Instruments/" target="_blank">http://creatified.com/svn/creatified/Instruments/</a></p>
<p>The trunk includes the latest development version. Don&#8217;t forget the &#8220;grails upgrade&#8221;-command after checking out the source tree.</p>
<p>When you run the app, all you&#8217;ll find there for the moment is the following site which will be located unter http://localhost:8080/instruments/</p>
<p>You will then be able to see something like this:</p>
<p><a href="http://creatified.com/blog/wp-uploads/2009/06/Instruments-CPU.png"><img class="alignnone size-medium wp-image-211" title="Instruments - CPU" src="http://creatified.com/blog/wp-uploads/2009/06/Instruments-CPU-300x147.png" alt="Instruments - CPU" width="300" height="147" /></a></p>
<p>for the CPU usage and this:</p>
<p><a href="http://creatified.com/blog/wp-uploads/2009/06/Instruments-Memory.png"><img class="alignnone size-medium wp-image-212" title="Instruments - Memory" src="http://creatified.com/blog/wp-uploads/2009/06/Instruments-Memory-300x129.png" alt="Instruments - Memory" width="300" height="129" /></a></p>
<p>for the Memory usage</p>
<p>This will be all for now, be sure to check out your own version &#8211; I&#8217;ll also be testing this on the Google AppEngine soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://creatified.com/blog/2009/06/grails-instruments-in-public-svn-now/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse and Grails</title>
		<link>http://creatified.com/blog/2009/06/eclipse-and-grails/</link>
		<comments>http://creatified.com/blog/2009/06/eclipse-and-grails/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 21:18:27 +0000</pubDate>
		<dc:creator>mat.i.am</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Groovy]]></category>

		<guid isPermaLink="false">http://creatified.com/blog/?p=206</guid>
		<description><![CDATA[In the last weeks I&#8217;ve been working on quite some different Grails applications. In my opinion Grails is really a great framework.
But one aspect that&#8217;s often annoying me is the Eclipse integration. Like many other guys I&#8217;d like to use Eclipse because for me TextMate is no full-blown IDE. But the default integration into Eclipse [...]]]></description>
			<content:encoded><![CDATA[<p>In the last weeks I&#8217;ve been working on quite some different Grails applications. In my opinion Grails is really a great framework.</p>
<p>But one aspect that&#8217;s often annoying me is the Eclipse integration. Like many other guys I&#8217;d like to use Eclipse because for me TextMate is no full-blown IDE. But the default integration into Eclipse is &#8220;incomplete&#8221; at best.</p>
<p>Here are some things I encountered with some possible solutions:</p>
<p>Unfortunately the generated Eclipse project files do not include a source link to the plugins directory of your project. Since Grails 1.1 this will be in your home-directory (at least on Unix-based systems) like ~/.grails/{GRAILS_VERSION}/projects/{PROJECT}/plugins, you will have to link this as a source folder when you&#8217;re using any plugins (which will often be the case)</p>
<p>The other thing is: if you&#8217;re including jars in the &#8220;lib&#8221; directory under your Grails project you will either add these jars manually to your build path or once again add this folder as a linked source folder.</p>
<p>I hope these issues will be addressed in a future release of Grails, hopefully as soon as 1.1.2 since these should not be too complicated to fix.</p>
]]></content:encoded>
			<wfw:commentRss>http://creatified.com/blog/2009/06/eclipse-and-grails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Project Mess Tool [updated]</title>
		<link>http://creatified.com/blog/2009/06/the-project-mess-tool/</link>
		<comments>http://creatified.com/blog/2009/06/the-project-mess-tool/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 20:55:15 +0000</pubDate>
		<dc:creator>mat.i.am</dc:creator>
				<category><![CDATA[1&1]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[study]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[PMT]]></category>

		<guid isPermaLink="false">http://creatified.com/blog/?p=198</guid>
		<description><![CDATA[At the moment I&#8217;m working on my second project thesis for my studies. The topic I have chosen in accordance with my company is the &#8220;Project Mess Tool&#8221; (PMT) as we named it.
So what&#8217;s this about? In a few words: The PMT is a tool which will allow us to keep track of many quality-relevant [...]]]></description>
			<content:encoded><![CDATA[<p>At the moment I&#8217;m working on my second project thesis for my studies. The topic I have chosen in accordance with my company is the &#8220;Project Mess Tool&#8221; (PMT) as we named it.</p>
<p>So what&#8217;s this about? In a few words: The PMT is a tool which will allow us to keep track of many quality-relevant metrics our company-website &#8220;produces&#8221; every day.</p>
<h3>Problem</h3>
<p>The sites we use for selling products are changed very often due to marketing campaigns. Not only do we have to change some images for that instead these are huge changes to the affected frontends. This of course results in the fact that many parts of our codebase are from older versions which may not be needed anymore.</p>
<p>At the moment we&#8217;re in the uncomfortable situation that we often don&#8217;t know how our pages really perform e.g. how many of the resources we deliver or keep are really necessary. We don&#8217;t know how many kilobytes (or even megabytes?) the average page weighs nor do we know where we could optimize easily.</p>
<h3>Possible solution: the PMT</h3>
<p>The PMT is designed as flexible as we think it can be. All it basically does is receive data from all different kinds of sources by offering a defined interface (a webservice). This will include information from</p>
<ul>
<li><a href="http://nicosteiner.de/archives/105-Einheitliche-Auslieferung-von-CSS-und-JavaScript.html">the Jasmin servlet</a> as mentioned by my <a href="http://nicosteiner.de/archives/140-Jasmin-Servlet-Performance-Optimierungen.html">colleague Nico Steiner</a> (both in German)</li>
<li>our <a href="http://pustefix-framework.org/">Pustefix framework</a> which renders the sites</li>
<li>some other emerging projects we will use to make our websites even faster</li>
</ul>
<p>In the end we will have information not only like &#8220;how many of the CSS selectors we deliver are really used by our pages?&#8221; but also &#8220;how does this change over time&#8221;. So we will be able to track quality with our predefined metrics and check back every week or so whether we have improved in those fields.</p>
<h3>Architecture</h3>
<p>I chose Grails to build this application &#8211; which I&#8217;m already pretty familiar with &#8211; but we&#8217;re also using some core Java libraries to add some features specific to the frameworks and technologies we use. Grails seemed like an ideal candidate for me because it already ships with the really powerful GORM abstraction layer. There are also plugins for other enterprise applications like the <a href="http://www.opensymphony.com/quartz/">Quartz enterprise job scheduler</a>. Grails makes it very easy to run all this stuff so I got done with the first steps pretty soon.</p>
<h3>Frontend</h3>
<p>At the moment I&#8217;m also drawing the first drafts of how the user interface of the PMT will look like. It will probably use <a href="http://code.google.com/p/flot/">Flot</a> which I also mentioned several times.</p>
<h3>Conclusion</h3>
<p>For me this is a really great project. Not only in its size &#8211; it&#8217;s definitely the biggest project I&#8217;ve been working on until today. But its also a project in which I spend all my effort and time of work this time. I think it will help a lot to improve the overall technical quality of our web frontends.</p>
<p>I&#8217;ll keep you updated with all major changes and milestones to the PMT. So what do you think of our idea?</p>
]]></content:encoded>
			<wfw:commentRss>http://creatified.com/blog/2009/06/the-project-mess-tool/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>YaS: Grails Instruments</title>
		<link>http://creatified.com/blog/2009/06/yas-grails-instruments/</link>
		<comments>http://creatified.com/blog/2009/06/yas-grails-instruments/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 20:15:09 +0000</pubDate>
		<dc:creator>mat.i.am</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://creatified.com/blog/?p=139</guid>
		<description><![CDATA[This evening I&#8217;m able to present you &#8220;Yet another Screen&#8221; (YaS) from Grails Instruments (btw: note that the G has been dropped in favor of &#8216;Grails&#8217; &#8211; I hope this is the last time I rename it).
Here&#8217;s the screen:
The cool thing is, the chart is rendered by flot (which I named before). At first I [...]]]></description>
			<content:encoded><![CDATA[<p>This evening I&#8217;m able to present you &#8220;Yet another Screen&#8221; (YaS) from Grails Instruments (btw: note that the G has been dropped in favor of &#8216;Grails&#8217; &#8211; I hope this is the last time I rename it).</p>
<p>Here&#8217;s the screen:</p>
<div id="attachment_144" class="wp-caption alignnone" style="width: 310px"><a href="http://matiam.creatified.com/blog/wp-uploads/2009/06/screen_03_06_09.png"><img class="size-medium wp-image-144" title="Screen of Grails Instruments' cpu monitor" src="http://matiam.creatified.com/blog/wp-uploads/2009/06/screen_03_06_09-300x243.png" alt="Screen of Grails Instruments' cpu monitor" width="300" height="243" /></a><p class="wp-caption-text">Screen of Grails Instruments&#39; cpu monitor</p></div>
<p>The cool thing is, the chart is rendered by flot (which I named before). At first I had planned to log the system metrics into a simple csv-file on the server. The logger would get the metrics every 500ms and then dump them to the csv. Not bad at all. It only turned very slow when I was then parsing the csv file in Groovy for the data I needed for drawing the chart &#8211; and that was a major performance killer. After caching about 10sec of system metrics the page would refresh after about 1-2sec which is just not fun&#8230;</p>
<p>So I went back and created a &#8220;specialized&#8221; cache class (for performance reasons: in Java) which will hold the metrics for the last 3 minutes (set the interval to 1000ms) in memory. This turned out to be much faster &#8211; for later versions there could be some &#8220;report functionality&#8221; which makes use of the csv-dumps (which will then be re-introduced ;-) ). For the moment the last 3minutes should be enough.</p>
<p>And the last thing I set up for today is the thing transmitting the cached results to the frontend (using json, what else?) and fills the data series for flot &#8211; resulting in something like the screen above.</p>
<p>There are plenty of things to be done yet. One thing is adding markings to the chart when certain events happen, &#8230; stay tuned, and as always: I&#8217;d appreciate your comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://creatified.com/blog/2009/06/yas-grails-instruments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A few updates on GInstruments</title>
		<link>http://creatified.com/blog/2009/05/a-few-updates-on-ginstruments/</link>
		<comments>http://creatified.com/blog/2009/05/a-few-updates-on-ginstruments/#comments</comments>
		<pubDate>Wed, 27 May 2009 20:50:43 +0000</pubDate>
		<dc:creator>mat.i.am</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web apps]]></category>

		<guid isPermaLink="false">http://creatified.com/blog/?p=136</guid>
		<description><![CDATA[After some days off last week I&#8217;m on it again&#8230; GInstruments definitely on the way I&#8217;d like it to be.
First things first: Fortunately Hyperic had placed an exception-statement into its GPL-licensed SIGAR &#8211; which allows to include the SIGAR binaries in &#8211; for example &#8211; Apache-licensed works. For me that&#8217;s really good news, because this [...]]]></description>
			<content:encoded><![CDATA[<p>After some days off last week I&#8217;m on it again&#8230; GInstruments definitely on the way I&#8217;d like it to be.</p>
<p>First things first: Fortunately Hyperic had placed an exception-statement into its GPL-licensed SIGAR &#8211; which allows to include the SIGAR binaries in &#8211; for example &#8211; Apache-licensed works. For me that&#8217;s really good news, because this means GInstruments could also be used in productive environments which I think often would not be GPL-compliant.</p>
<p>Second: One of the basic things I always wanted to have seems really close now. At the moment GInstruments only displays your current system usage &#8211; not too useful, because most times you&#8217;d be interested in the usage over time, say for the past 30 seconds or so. So that&#8217;s one of the core features I&#8217;ll be implementing before releasing anything to the public &#8211; sorry for the delay, I&#8217;m very busy in other projects right now, too.</p>
<p>For the next few weeks I&#8217;ll also be testing on various kinds of systems (Windows, Linux, &#8230;) and of course testing on Google AppEngine whether they support all the necessary features.</p>
<p>And for a great user experience I&#8217;ll also be working very hard on a prototype of the UI.</p>
<p>Some things that will probably make it into the first public release include:</p>
<ul>
<li>logging system usage and events to a set of CSV-files (configurable in later versions)</li>
<li>usage graphs on the client-side using <a href="http://code.google.com/p/flot/" target="_blank">flot</a></li>
<li>more? yeah, sure!</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://creatified.com/blog/2009/05/a-few-updates-on-ginstruments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GInstruments &#8211; a new Grails plugin&#8230; soon!</title>
		<link>http://creatified.com/blog/2009/05/ginstruments/</link>
		<comments>http://creatified.com/blog/2009/05/ginstruments/#comments</comments>
		<pubDate>Sat, 23 May 2009 19:03:59 +0000</pubDate>
		<dc:creator>mat.i.am</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[web apps]]></category>

		<guid isPermaLink="false">http://creatified.com/blog/?p=123</guid>
		<description><![CDATA[As a developer I&#8217;m very often on the hunt for every last bit of performance &#8211; trying to optimize every single function of my program.
In the past weeks I&#8217;ve been thinking of, designing and developing on a new plugin for the growing framework Grails. It will be called GInstruments and it aims to provide some [...]]]></description>
			<content:encoded><![CDATA[<p>As a developer I&#8217;m very often on the hunt for every last bit of performance &#8211; trying to optimize every single function of my program.</p>
<p>In the past weeks I&#8217;ve been thinking of, designing and developing on a new plugin for the growing framework Grails. It will be called GInstruments and it aims to provide some useful clues for Grails developers who want to know how their application is performing.</p>
<p>The plugin uses Hyperic&#8217;s (<a href="http://www.hyperic.com/springsource/" target="_blank">now SpringSource</a>) <a href="http://support.hyperic.com/display/SIGAR/Home" target="_blank">SIGAR</a> (System Information Gatherer And Reporter) to report vital system information such as CPU usage or memory comsumption overall or for the current process.</p>
<p>The first release (0.1) is only going to be a snapshot of my first ideas, hence I&#8217;ll not release it to the official Grails plugin repositories. It will show you some information about your system like name, version, vendor or architecture, the current CPU and memory consumption. Especially for your current process (which will be the relevant information to know). Take a look at this:</p>
<div id="attachment_127" class="wp-caption alignnone" style="width: 408px"><a href="http://matiam.creatified.com/blog/wp-uploads/2009/05/ginstruments-01.png"><img class="size-full wp-image-127" title="First draft of GInstruments 0.1" src="http://matiam.creatified.com/blog/wp-uploads/2009/05/ginstruments-01.png" alt="First draf of GInstruments 0.1" width="398" height="302" /></a><p class="wp-caption-text">First draft of GInstruments 0.1</p></div>
<p>All these features are subject to change (I first wanted to know whether there could be a future for this). Possible features for the future may include</p>
<ul>
<li>logging of metrics (cpu, memory, swap, network, &#8230;)</li>
<li>tracking of Grails events (requests, &#8230;)</li>
<li>visualization of these two and more components over time to detect points of interest</li>
</ul>
<p>I&#8217;m open to all kinds feature requests but please bear in mind that I&#8217;m only doing this in my spare time, after work, school whatsoever ;-)</p>
<p>At last let me point you to a link (for the non-Apple-developers) to <a href="http://www.apple.com/macosx/developertools/instruments.html" target="_blank">how Apple&#8217;s Instruments-app looks like</a>. I think it has some other cool possibilities.</p>
<p>At the moment I&#8217;m also waiting for some response from the guys from Hyperic. I really want to license the plugin under the terms of the Apache License (the license Grails uses and many other plugins) &#8211; SIGAR is GPL-only at the moment.</p>
<p>Do you think this could be a useful plugin for the Grails infrastructure? What&#8217;s your opinion.</p>
]]></content:encoded>
			<wfw:commentRss>http://creatified.com/blog/2009/05/ginstruments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grails &#8211; ImageTools-Plugin</title>
		<link>http://creatified.com/blog/2009/05/grails-imagetools-plugin/</link>
		<comments>http://creatified.com/blog/2009/05/grails-imagetools-plugin/#comments</comments>
		<pubDate>Fri, 08 May 2009 20:05:37 +0000</pubDate>
		<dc:creator>mat.i.am</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[JAI]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDK]]></category>
		<category><![CDATA[JPEG]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[web apps]]></category>

		<guid isPermaLink="false">http://creatified.com/blog/?p=103</guid>
		<description><![CDATA[There have already been some posts about the Grails Framework on my blog, so here&#8217;s one about the ImageTools plugin. This plugin leverages some functionality of the Java Advanced Imaging API (JAI) to make handling images a lot easier for Grails developers. However, some people seem to be complaining about poor image quality &#8211; I [...]]]></description>
			<content:encoded><![CDATA[<p>There have already been some posts about the <a href="http://www.grails.org">Grails Framework</a> on my blog, so here&#8217;s one about the <strong><a href="http://www.grails.org/ImageTools+plugin">ImageTools plugin</a>.</strong> This plugin leverages some functionality of the <a href="https://jai-imageio.dev.java.net/">Java Advanced Imaging API (JAI)</a> to make handling images a lot easier for Grails developers. However, some people <a href="http://javazquez.com/juan/category/grails/">seem to be complaining</a> about poor image quality &#8211; I guess they&#8217;re about the poor resizing-results when using the thumbnail functionality.</p>
<p>The default method for creating thumbnails is the following</p>
<blockquote>
<pre>def imageTool = new ImageTool()</pre>
<pre>imageTool.load("/path/to/image.jpg")</pre>
<pre>imageTool.thumbnail(640)</pre>
</blockquote>
<p>This will load the file, create a new ImageTool instance and make a thumbnail out of it, where the max width/height will be 640px. However the resizing quality is very bad because by default it uses nearest neighbor for interpolation. You will encounter this especially when you&#8217;re rendering small thumbnails out of large images.</p>
<h3>A possible solution</h3>
<p>Because there is no detailed documentation about the ImageTools plugin (actually I didn&#8217;t find any) one will have to inspect the source code to find something very cool: ImageTools also provides a method called &#8220;<strong>thumbnailSpecial</strong>&#8221; which can use other interpolation and rendering algorithms and you can use it instead of the basic &#8220;thumbail()&#8221;. It&#8217;s signature is as follows</p>
<blockquote>
<pre>thumbnailSpecial(float maxWidth,
                 float maxHeight,
                 int interPolationType,
                 int renderingType)</pre>
</blockquote>
<p>maxWidth and maxWidth are pretty self-explaining, just set them to the same values (for example 640) to achieve the same dimensions as above.</p>
<p>interPolationType is one of</p>
<p><strong>1</strong>: &#8220;bilinear interpolation&#8221; &#8211; which is at least better than nearest<br />
<strong>2</strong>: &#8220;bicubic interpolation&#8221; &#8211; which is even better and<br />
<strong>3</strong>: &#8220;bicubic2 interpolation&#8221; &#8211; which may even better</p>
<p>these are JAI names for them, don&#8217;t ask me about the details</p>
<p>renderingType is one of<br />
<strong>1</strong>: &#8220;scale&#8221; &#8211; the default function JAI uses<br />
<strong>2</strong>: &#8220;SubsampleAverage&#8221; &#8211; which will provide better results</p>
<p>Please keep in mind that all the &#8220;better results&#8221; require <strong>a lot more rendering time</strong> and are likely to consume more memory &#8211; but the results will be way smoother then.</p>
<p>So that may help some people out there which have experienced poor quality at this end.</p>
<p>For me there are only two further caveats when using ImageTools/JAI.</p>
<p>First: <strong>performance</strong> is very bad when using pure Java mode (which will be the default unless you provide a &#8220;native accelerator&#8221; for JAI). On my Mac this is no problem &#8211; as far as I know Apple provides a native accelerator in its own JDK on Mac OS X (and I never got messages like <a href="http://www.grails.org/ImageTools+plugin">detailed on the plugin page</a>) &#8211; yeah, using CoreGraphics/CoreImage, whatever&#8230; correct me if I&#8217;m wrong ;-) but I never got it to run on my production system (Ubuntu Server).</p>
<p>Second: JAI seems to have some other <strong>strange problems with JPEGs on Linux</strong> (I tried both OpenJDK and Sun&#8217;s JDK, always JAI in pure Java mode): some JPEGs will have inverted colors in the resulting thumbnail &#8211; couldn&#8217;t find out any details but I think something about the JPEG implementation is broken. This also affects saving JPEGs for me. It got strange exceptions when saving images as JPEGs causing that to fail &#8211; so I fell back to using PNGs &#8211; which is everything but cool in many cases :-(</p>
<p>As said these two problems only occurred on Linux (Ubuntu 9.04) &#8211; not on Mac OS X (couldn&#8217;t test on Windows) &#8211; but since most web apps I&#8217;m writing will be running on Linux some day this is a very annoying problem &#8211; and unfortunately I don&#8217;t see any progress on the ImageTools plugin or JAI. Anybody else got this kind of problem?</p>
<p>So I&#8217;m very tended to give something like good old <a href="http://www.imagemagick.org/">ImageMagick</a> a try &#8211; maybe using <a href="http://im4java.sourceforge.net/">im4java</a> or <a href="http://www.jmagick.org/index.html">JMagick</a> &#8211; or something else.</p>
]]></content:encoded>
			<wfw:commentRss>http://creatified.com/blog/2009/05/grails-imagetools-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
