• Post Reply Bookmark Topic Watch Topic
  • New Topic

Faster JPGs??  RSS feed

 
Nick Fisher
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me if there is a faster way of getting JPG images to load in Java other than the Toolkit.getImage() method?

I'm trying to write an image viewing application which supports large JPGs like the ones taken with digital cameras. Some of these images can be 2816 x 2120 pixels in size (a 6 mega-pixel image). Unfortunately, Java is VERY slow at working with these images! In my test runs, it takes over 30 seconds just to display a 1600 x 1200 image to the screen!!

Surely there must be a faster way of doing it than this? I know it's not my processor which is slowing things down, because applications like MS Paint can load these images almost instantaneously (takes literally less than a second)!


Any help would be much appreciated.

Thanks,


Nick
 
Pat Hays
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Nick,

I have never tried Toolkit.getImage(), so I don't know which way is faster, but on my computer, new ImageIcon() is enough fast.

Try this: jLabel1.setIcon(new ImageIcon("C:\\photos\\myPhoto.jpg"));

----------
Create your Java GUI application in minutes, http://www.mars3000.com
[ August 30, 2004: Message edited by: Pat Hays ]
 
Nick Fisher
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Pat. I have managed to get it working another way now.


Nick
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
whats the other way ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!