aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Resizing Images:  Uncaught error fetching image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Resizing Images:  Uncaught error fetching image " Watch "Resizing Images:  Uncaught error fetching image " New topic
Author

Resizing Images: Uncaught error fetching image

Adam Mellen
Greenhorn

Joined: Sep 19, 2003
Posts: 6
Hi,
What I am trying to do is to resize an image (can be jpeg, gif, or png). However, when I try to resize the image, I sometimes get the following error:
Uncaught error fetching image:
java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.IntegerInterleavedRaster.setDataElements(IntegerInterleavedRaster.java:404)
at sun.awt.image.ImageRepresentation.setPixels(ImageRepresentation.java:494)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at java.awt.image.AreaAveragingScaleFilter.accumPixels(AreaAveragingScaleFilter.java:196)
at java.awt.image.AreaAveragingScaleFilter.setPixels(AreaAveragingScaleFilter.java:261)
at sun.awt.image.ImageDecoder.setPixels(ImageDecoder.java:120)
at sun.awt.image.JPEGImageDecoder.sendPixels(JPEGImageDecoder.java:118)
at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
at sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:144)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:257)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:168)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
I've done some searching online, and have found documentation that appears to be similar to this error (see http://developer.java.sun.com/developer/bugParade/bugs/4447975.html and http://forum.java.sun.com/spider.jsp?f=5&t=7995)
But what I couldn't find was any solutions for this bug. (the develiper.java.sun page said that the bug had been fixed, but obviously there are still some issues). Does anyone have any solutions as to how to work around this bug/error?
Thanks! Oh, I am developing on Windows XP, using the Java 2 sdk 1.4.1_02 ( j2sdk1.4.1_02)
Here is the code that gives the error:
Image myImage2 = myImage.getScaledInstance ((tempWidth + X3), (tempHeight + Y3), Image.SCALE_SMOOTH );

// I also use a MediaTracker to track the image being loaded
Adam Mellen
Greenhorn

Joined: Sep 19, 2003
Posts: 6
I think I may have found a solution to this problem (initial results look VERY promising! )I simply updated my j2sdk from version 1.4.1_02 to version 1.4.2_02 and now I no longer get the error message when I resize the images...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Resizing Images: Uncaught error fetching image