Will, you hit a topic, I just recently decided to solve once and forever. I am spending lots of late nights digging my self through the mists of digital image processing. While yes, Java offers classes and methods to scale images, they usually concentrate on speed rather than quality. I noticed weird behaviors, e.g. I had a 350k jpeg image, past it through my test script with NO scaling and got an image with about 250k in size and slightly worse quality! Java 6 seems to offer better image processing packages, but I did not dig into that yet, since Java 6 might not be on most machines yet.

My challenge is to scale an image (yes, I am already happy if I can "only" scale at a high quality) of different formats (e.g. jpg, gif, png) with one package. I have a solution which is ok, and maybe I am trying to reach for the sky, but I still am sure by tweaking the algorithm I can achieve better results.

My 2cts: Scaling down requires "removing pixels". So if you just scale down from e.g. 640x480 to 160x120 in one "swoosh", quality is worse than if you scale in multiple steps. If you scale up, you have to add pixels and it's a similar issue. If you do it in one "swoosh", quality will not be as good as if you do it in multiple small steps. However, many blogs nag on the multiple steps because that affects performance.

Well, I am still on this topic. I will keep you updated.

Cheers
Giancarlo


On Mar 10, 2009, at 3:55 AM, Will Scheidegger wrote:


Well, JAI seems to be the solution, but as I said: I have yet to find an example based on JAI which produces high quality results with a wide range of image sizes without any funky side effects...

-will

On 10.03.2009, at 11:46, Peter Götz wrote:


Thanks for the article URL. Maybe there is hope and a way to get image manipulation without having to use ImageMagick. I know the pains you know, Will, and I would be glad to get them solved. :)

Peter
__________________________
Accelsis Technologies GmbH
Innovative IT-Lösungen

Aidenbachstr. 52, D-81379 München
phone: +49 89 548038-0 (-76 direct), fax: +49 89 548038-99
[email protected], http://www.accelsis.biz

Hauptsitz der Accelsis Technologies GmbH: Aidenbachstr. 52, D-81379 München
Geschäftsführer: Andreas Penzel, Klaus Schlumpberger
Amtsgericht München, HRB 138056


----- Original Message -----
From: Will Scheidegger
[mailto:[email protected]]
To: Magnolia User-List
[mailto:[email protected]]
Sent: Tue, 10 Mar 2009 11:18:30
+0100
Subject: Re: [magnolia-user] OT: Image scaling algorithm



Thanks Peter and Tobias for the quick replies.

We've used ImageMagick before with good results - it's just really
hard for me to believe, that I need to talk to a C program over JNI
only to get a decent scaled image. And since this makes the
installation of webapps on servers a pain it's no real option for us.

We've also used "getScaledInstance()" in Java. But apparently one
should not go that way.
http://weblogs.java.net/blog/chet/archive/2007/04/dont_use_getsca.html

The more you google the more opinions you get on that topic ;-)

-will

On 10.03.2009, at 10:48, Tobias Reinhardt wrote:


Hi Will

The following article explains the different pitfalls for image
scaling with java quite well. And it includes some code how to do it right. I don't know if it is the best solution, but it is enough for
me.

http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html

If you use the multistep scaling flag of the provided helper method,
ensure that your server has enough memory.

Tobias


2009/3/10 Will Scheidegger <[email protected]>:
Dear Magnolians
This is quite off-topic, but I'm sure many of you have been faced
by the
same problem: Image scaling in Java.
I tried many different methods, googled for hours if not days, but
either
I'm getting low quality results or the thumbs have other "side
effects" like
a black border on one or two sides...
Does anyone have the definite solution to a problem which really
should not
be rocket science? I hate it when things are oh so easy in Typo3 :-/
Thanks!
-will

--

fastforward websolutions

Kramgasse 16, CH-3011 Bern

Tel. +41 31 348 54 44, Fax +41 31 348 54 55

www.fastforward.ch

--


________________________________
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia- cms.com>
----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------




----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to