Click here to Skip to main content
15,888,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Anyone know of a way of converting an icon to a bitmap that would be larger than 32 x 32? I am trying to display the icon that a user chooses, but 32 x 32 is a tad bit too small. I know I need an icon to be larger than 32 x 32 in the first place, which I do, but the
VB
Icon.ToBitmap
seems to only do 16 x 16 and 32 x 32 regardless how big the icons are.

Thanks in advance.
Posted
Updated 1-Jul-12 11:44am
v2

It makes no sense, usually. Well, how larger? The bitmaps are usually too small; sizes of 40x40 or 64x64 can be considered as very big, you hardly can find any bigger. Also, makes sure you have a legal rights to use some available bitmap the way you want.

But the most important factor is this: you can re-sample any bitmap down with acceptable quality, unless extreme cases of a very small ones (16, or 32 pixels are already small), which usually requires manual improvements, which in turn requires special skills and experience. As to the enlargements, all automatic re-sampling methods gives quite lousy quality. (Ever heard of information entropy, http://en.wikipedia.org/wiki/Entropy_%28information_theory%29[^]?)

For more or less large images (say, some 50 pixels and more), it's way more beneficial to create and store vector image. Each time you need a bitmap, you should scale a vector image to the size of the bitmap (or more, for subsequent re-sampling down later), and export it as a bitmap. The exported bitmaps can be used to create icons as well. One highly recommended product is the open-source Inkscape, please see:
http://en.wikipedia.org/wiki/Inkscape[^],
http://inkscape.org/[^].

[EDIT]

Sorry for misunderstanding. There are more than one bitmap in the icon. Extracting them is easy enough. Please see this CodeProject article:
Extracting and displaying icons with VB.NET[^].

Pay attention for the class IconImage and see how it works in the code which comes with the article.

—SA
 
Share this answer
 
v3
Comments
Rokas Gustys 1-Jul-12 19:53pm    
Thanks, for the reply. But there must be a way to do it. There are icon viewers made in VB 6 that allow you to view even a 256 x 256 icon, but I have no idea how to do it in VB.NET 10
Sergey Alexandrovich Kryukov 2-Jul-12 4:23am    
To do what? To re-sample a bitmap up and get perfect quality? Did you ever heard that there is no such thing as miracle? Technical means can only assist you. The best method I tries was the fractal compression method, it allows for enlargement, but for bigger source files and with limited quality, which is always limited. Understand finally, that with a small bitmap you have not enough information... Again, use it as a guide to vectorize...

By the way, did you vote "3". If you did, why?
--SA
Rokas Gustys 2-Jul-12 7:11am    
I though my question was clear enough if you actually read it. I don't want enlargement. Look I have an icon file that has a 256 x 256 32-bit depth quality icon in, and I simply asking for a way to convert that icon data into bitmap data, one file type to another simple as that. So far I only know of one but it limits me to only 32 x 32 in size, which is really small. I appreciate you're answer, but I will not stop until I find away, because I know there is one.
Sergey Alexandrovich Kryukov 2-Jul-12 15:31pm    
OOPS! I don't know why I had the impression that you need to re-sample it, probably was distracted by your "larger", sorry about that.
Do you need to extract bitmaps from the icon programmatically, in your code, or you need just to do it somehow?
--SA
Sergey Alexandrovich Kryukov 2-Jul-12 15:34pm    
Please see my update above, after [EDIT].
--SA
Icon.ToBitmap


It works, just gotta must make sure the icon only contains the size you want or try somehow splitting the icon into different sizes and then using it.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900