0

I've got a java servlet which is hitting this bug when down-scaling images...

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5101502

I'm trying to work out the best way to work around it and would appreciate any ideas from the community.

Thanks, Steve

Juha Syrjälä
  • 33,425
  • 31
  • 131
  • 183
Steve Buikhuizen
  • 1,283
  • 3
  • 12
  • 17

2 Answers2

3

Image scaling with Java can be surprisingly complicated - I ran into lots of reproducable JVM crashes when doing batch processing, which are not related to your bug though. In the end I ended up using the external command line tool 'convert' from ImageMagick, available for the relevant platforms. Simply call it with Runtime.exec(.) and the appropriate parameters. Might be even faster than a real Java solution, but this is certainly not a good solution for all apps.

the.duckman
  • 6,376
  • 3
  • 23
  • 21
1

You might want to use the Java Advanced Imaging (JAI) API. An example of how to scale an image using JAI can be found here.

entzik
  • 654
  • 4
  • 8