?
Solved

About loading images

Posted on 2001-08-01
4
Medium Priority
?
150 Views
Last Modified: 2010-03-31
Hi
 here is some code i need better way for this

Image img=Toolkit.getImage(file);
Image scaledIMg=img.getScaledInstance(100,100,this);

like that i am loading few images which are very big so this is taking some time to load is there a betterway to do this. without using 3rd party tools

thanks
0
Comment
Question by:skgaju
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 6340384
Sorry I don't think you can avoid loading the whole image to scale it.
0
 
LVL 1

Expert Comment

by:lawrie
ID: 6341507
This should do exactly what you want

image = createImage(new FilteredImageSource(
image.getSource(), new CropImageFilter(x, y, w, h)));

where x, y, w, h defines the region you want

Hope this helps
0
 
LVL 92

Expert Comment

by:objects
ID: 6354410
That still requires the entire image to be loaded into memory.
0
 
LVL 5

Expert Comment

by:lwinkenb
ID: 8895213
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept comment by objects as answer.
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
lwinkenb
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question