I've never tried to use getScaledInstance, but fwiw, here is
my take.
I wouldn't expect that approach to have usable results. If you
want ICONs in multiple sizes you need to get the graphic artist
to design them both ways.
Increasing an existing ICON in size is feasible, especially if
you are just doubling it, such as 16x16 to 32x32. But even then
you end up with a 32x32 ICON that underutilzes its pixels, and
won't look very good.
Shrinking almost never has a chance because the ICON designer
probably used all the pixels he/she had to cleverly give the
ICON the well recognized appearance of something familiar.
No software is going to be able to cram that same artwork into
fewer pixels via an algorythm (in most cases).
If you're talking about an image with much more data, such as
a photograph, with thousands of pixels. then scaling software
can attempt to revise the colors to retain the appearance.
For standard ICON's there is a Java package (you can find it via
JDC), that I think supplies 16x16 and 24x24. There are also a
multitude of other packages available online.
... Roger
------------------------------------------
From: SMTP%"[EMAIL PROTECTED]" 3-MAR-2001 07:26:43.30
To: SMTP%"[EMAIL PROTECTED]"
CC:
Subj: How to make a little image from another larger.
I have to show an image in reduced size in the toolbar of a Java
application.
The problem is that the scalation method makes the resolution in the
image very poor. I've tried to use all the scalations methods existing
in the Image class, but they all produce similar results.
Here is an example about what I want to do:
JToggleButton buttonWithReducedImage =
new JToggleButton(new ImageIcon(
largeImage.getScaledInstance(
WIDTH, HEIGHT, Image.SCALE_SMOOTH)));
Please, if you have some idea about how to solve this problem, tell me.
Thanks a lot.
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing