
java-image-scaling - issue #3
ResampleOp.verticalFromWorkToDst() -> ArrayIndexOutOfBoundsException
Using the 0.7.2 release:
java.lang.ArrayIndexOutOfBoundsException: 5 at com.mortennobel.imagescaling.ResampleOp.verticalFromWorkToDst(ResampleOp.java:316) at com.mortennobel.imagescaling.ResampleOp.doFilter(ResampleOp.java:163) at com.mortennobel.imagescaling.AdvancedResizeOp.filter(AdvancedResizeOp.java:81) at com.psibt.plantmonitor.graphic.widgets.AnimatedPicture.paintComponent(AnimatedPicture.java:180) at javax.swing.JComponent.paint(JComponent.java:1027) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JLayeredPane.paint(JLayeredPane.java:564) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JLayeredPane.paint(JLayeredPane.java:564) at net.sourceforge.jruntimedesigner.JRuntimeDesigner.paint(JRuntimeDesigner.java:494) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JViewport.paint(JViewport.java:747) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1030) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paint(JComponent.java:1036) at javax.swing.JLayeredPane.paint(JLayeredPane.java:564) at javax.swing.JComponent.paintChildren(JComponent.java:864) at javax.swing.JComponent.paintToOffscreen(JComponent.java:5129) at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:277) at javax.swing.RepaintManager.paint(RepaintManager.java:1217) at javax.swing.JComponent.paint(JComponent.java:1013) at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21) at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60) at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97) at java.awt.Container.paint(Container.java:1780) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:814) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:714) at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:694) at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
The layout I am scaling has about 50 pictures. Its size is 1920 x 1200. When zooming out under 60%, this exception is thrown. The code I use is:
private BufferedImage originalImage; private ResampleOp resampleOp;
resampleOp = new ResampleOp(scaledImageWidth, scaledImageHeight); resampleOp.setUnsharpenMask(AdvancedResizeOp.UnsharpenMask.Normal); rescaledImage = resampleOp.filter(originalImage, null); g.drawImage(rescaledImage, 0, 0, null); g.dispose();
Comment #1
Posted on Jul 7, 2009 by Helpful KangarooI have created a test-case, but have been unable to reproduce the error.
Could you provide me with the value of scaledImageWidth and scaledImageHeight?
Comment #2
Posted on Jul 8, 2009 by Happy Wombatsorry, I've just realized that this issue is equivalent to the issue number 2. The exception is thrown when any of the existing images within the layout is scaled with a size smaller than 3 pixels. When replacing ResampleOp() with ImprovedMultistepRescaleOp(), everything works fine. The new code I'm using is:
private BufferedImage originalImage; private BufferedImageOp resampleOp; private BufferedImage rescaledImage; private int scaledImageWidth; private int scaledImageHeight;
resampleOp = new ImprovedMultistepRescaleOp(scaledImageWidth, scaledImageHeight); rescaledImage = resampleOp.filter(originalImage, null); g.drawImage(rescaledImage, 0, 0, rescaledImage.getWidth(), rescaledImage .getHeight(), null); g.dispose();
Comment #3
Posted on Jul 8, 2009 by Helpful Kangaroo(No comment was entered for this change.)
Status: Duplicate
Labels:
Type-Defect
Priority-Medium