hupeng1991 / java-image-scaling

Automatically exported from code.google.com/p/java-image-scaling
Other
0 stars 0 forks source link

ResampleOp.createSubSampling() ArrayIndexOutOfBoundsException #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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);

Original issue reported on code.google.com by d.p.holr...@googlemail.com on 15 Mar 2009 at 12:11

GoogleCodeExporter commented 8 years ago
I'd also note that the code worked fine until I adjusted WIDTH_THUMBNAIL to the 
value
given.

Original comment by d.p.holr...@googlemail.com on 15 Mar 2009 at 12:12

GoogleCodeExporter commented 8 years ago
The 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.

Original comment by janne.hi...@gmail.com on 27 Apr 2009 at 10:31

GoogleCodeExporter commented 8 years ago
Thanks 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.

Original comment by m%nobel-...@gtempaccount.com on 7 Jun 2009 at 7:42

GoogleCodeExporter commented 8 years ago
Fixed in version 0.7.2

Original comment by m%nobel-...@gtempaccount.com on 9 Jun 2009 at 9:13