
java-image-scaling - issue #1
ResampleOp.createSubSampling() ArrayIndexOutOfBoundsException
Using the 0.7 release,
java.lang.ArrayIndexOutOfBoundsException: 8436 at com.mortennobel.imagescaling.ResampleOp.createSubSampling(ResampleOp.java:240) at com.mortennobel.imagescaling.ResampleOp.doFilter(ResampleOp.java:133) at com.mortennobel.imagescaling.AdvancedResizeOp.filter(AdvancedResizeOp.java:69)
The image I'm scaling is 1367x888. The code I'm using is roughly,
int WIDTH_THUMBNAIL = 57; DimensionConstrain dimThumb = DimensionConstrain.createMaxDimension(WIDTH_THUMBNAIL, (int)(WIDTH_THUMBNAIL/1.5)); BufferedImage image = ImageIO.read(data); ResampleOp resampleOp = new ResampleOp(dimThumb); resampleOp.setFilter(ResampleFilters.getLanczos3Filter()); BufferedImage rescaled = resampleOp.filter(image, null);
Comment #1
Posted on Mar 15, 2009 by Swift ElephantI'd also note that the code worked fine until I adjusted WIDTH_THUMBNAIL to the value given.
Comment #2
Posted on Apr 27, 2009 by Helpful LionThe following code: BufferedImage inputImage = ImageIO.read(new FileInputStream("test.jpg")); new ResampleOp(51, 51).filter(inputImage, null);
Fails every time with exception:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3774 at com.mortennobel.imagescaling.ResampleOp.createSubSampling(ResampleOp.java:240) at com.mortennobel.imagescaling.ResampleOp.doFilter(ResampleOp.java:133) at com.mortennobel.imagescaling.AdvancedResizeOp.filter(AdvancedResizeOp.java:81)
When scaling image: http://www.koskue.net/test.jpg
When width is something else than 51 everything works just fine.
Comment #3
Posted on Jun 7, 2009 by Helpful KangarooThanks for the feedback - and sorry for not responding before now (I didn't configure the google code to notify me on new issues).
I have reproduced the bug and will hopefully soon have a patched version ready.
Comment #4
Posted on Jun 9, 2009 by Helpful KangarooFixed in version 0.7.2
Status: Verified
Labels:
Type-Defect
Priority-Medium