my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes image distoration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "image distoration" Watch "image distoration" New topic
Author

image distoration

Craig Parsons
Ranch Hand

Joined: Jan 28, 2004
Posts: 40
I am zooming in and out of an image using
ImageIcon images2 = new ImageIcon(images[imageCount].getImage().getScaledInstance(width, height, Image.SCALE_SMOOTH));
Everything is working except after zooming in and out a couple of times the image starts getting distorated. Almost to the point that I can't even recognize the image.
Any ideas,
Craig
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
Are you scaling from your new image each time? You lose a little information each time you scale, so after a few iterations, that would cause visible distortion. The fix, if that's the problem, would be to scale from the original image each time, keeping track of the cumulative scaling factor.
Warren
Craig Parsons
Ranch Hand

Joined: Jan 28, 2004
Posts: 40
I see your point. I'm scaling from the new "zoomed" image not the original image. Let me look into scaling from the original each time.
Thanks,
 
 
subject: image distoration