Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

About loading images

Posted on 2001-08-01
4
Medium Priority
?
152 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
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

963 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