dragon66 / java-image-scaling

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

ResampleOp.verticalFromWorkToDst() -> ArrayIndexOutOfBoundsException #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using the 0.7.2 release:

java.lang.ArrayIndexOutOfBoundsException: 5
at
com.mortennobel.imagescaling.ResampleOp.verticalFromWorkToDst(ResampleOp.java:31
6)
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(AnimatedPi
cture.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:49
4)
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(SystemEventQueueU
tilities.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();

Original issue reported on code.google.com by p.palac...@psi-bt.de on 7 Jul 2009 at 9:00

GoogleCodeExporter commented 9 years ago
I have created a test-case, but have been unable to reproduce the error.

Could you provide me with the value of scaledImageWidth and scaledImageHeight?

Original comment by m%nobel-...@gtempaccount.com on 7 Jul 2009 at 4:22

GoogleCodeExporter commented 9 years ago
sorry, 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();

Original comment by p.palac...@psi-bt.de on 8 Jul 2009 at 8:08

GoogleCodeExporter commented 9 years ago

Original comment by m%nobel-...@gtempaccount.com on 8 Jul 2009 at 4:14