Solved

About loading images

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now