Solved

About loading images

Posted on 2001-08-01
4
147 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 50 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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

617 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