Solved

About loading images

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySQL  on Tomcat 8 71
jdbc error in jsp application 20 64
Notify sent to other threads in Java 9 34
Using jdbcTemplate.batchUpdate to improve INSERT performance 6 24
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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 “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

820 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