aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes ImageIcon performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "ImageIcon performance" Watch "ImageIcon performance" New topic
Author

ImageIcon performance

Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
Hi, I'm trying to load a large list of images from my HD into an application using ImageIcon to get the images width and height, but I'm experiencing performance issues, without creating an Imagicon (so I don't get image attributes) it works really fast, but if I create an imageicon to get those attributes (I need them) it works so slow, anyone has a solution?? Thanks.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
You don't need to create an ImageIcon to get the size from an Image. Why don't you use Image#getWidth and Image#getHeight?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
the only way I've found to create an image from a path is using imageicon. If you know how to do it without using it, please tell me. I haven't had much time to search...
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Take a look at package javax.imageio. In it, ImageReader has methods getHeight and getWidth.


There is no emoticon for what I am feeling!
Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
I'm using it now actually, but it has the same performance problem. Thanks for the advice.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ImageIcon performance