Jump to content
  • Advertisement
Sign in to follow this  
Mercury

Resizing Icons in Win32

This topic is 4809 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I'm working on a project where I need to resize a 32x32 icon to 24x24 as well as 16x16 in a few instances. Is there a function that can resize the icons that isn't DrawIconEx? DrawIconEx works, but the image is horrible quality. There must be an image resizing function in windows... Anyone have any ideas? One thing I was thinking of doing was rendering the icon to a device context at the normal size, then resizing it using GDI or something, there must be a way to resize bitmaps in Win32.

Share this post


Link to post
Share on other sites
Advertisement
When working with images of that size pretty much any automated resizing is going to look like crap. Unless your icon is a big square or something like that. I'd recommend just biting the bullet and manually creating icons of the right size.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
When working with images of that size pretty much any automated resizing is going to look like crap. Unless your icon is a big square or something like that. I'd recommend just biting the bullet and manually creating icons of the right size.

That's not an option, unfortunately. The application is similar to the MS Office Toolbar; it shows the contents of a directory on a toolbar that can be docked on the side of the screen.

Share this post


Link to post
Share on other sites
Quote:
Original post by Daniel Miller
Recreate the icon from the original large image (don't scale from 32x32)?

I don't understand what you mean. I'm loading the icons that the application shows by using ExtractAssociatedIcon. There are no large images to use.

Share this post


Link to post
Share on other sites
The image, whether it be big or small is going to look bad distorted. There's no win32 function to apply any sort of interpolation to make a distored image/icon look more proportional. If you only resize certain icons that come with your program, then you should just have copies of them at different sizes what were shrunk with something else that didn't just shrink it. If you're having your program accept icons from the user, i.e. you can't just have copies of some icons at different sizes in your program, then you probably need to look into bilinear interpolation or gaussian blur technique. Surely there's source or documentation out there for you to learn from.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
GDI+ has a number of quality settings to use when resizing. the more computationally expensive ones, bilinear and bicubic, yield reasonably good results when resizing from a small image to an slightly smaller one, especially if pre-filtering is used, so i would think resizing from 32 to 24 would work okay. i don't know about 32->16 though.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mercury
I don't understand what you mean. I'm loading the icons that the application shows by using ExtractAssociatedIcon. There are no large images to use.


Eh, they looked really crap for me (I tried using that call myself). If you look in my journal there is some VB.NET code (should be easy enough to follow!) that runs through the registry to get the correct icon so you can then use ExtractIconEx to extract the icon "properly". Note that under WindowsXP the alpha blended icons are not converted properly when using the Icon.ToBitmap call, but I assume that you're not doing it that way.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!