[RESOLVED] [2005] Getting image from embedded resource
I currently grab an image from an embedded resource using
VB Code:
Dim WImage As Image = New Bitmap(Me.GetType(), "myimage.png")
but the result is poor compared to the original png. The conversion to a bitmap seems to dramatically lower the quality since any white space in the image gets filled with a different color. I tried improving the PixelFormat, but it does not have much effect. Is there a way I can get the image directly, rather than having to go through a bitmap?
Re: [2005] Getting image from embedded resource
Actually, the problem is not the bitmap quality, it is the appearance of the image when used as a ListView item image. If I put the image into a picturebox, it looks perfect, use it in a listview, looks horrible.
What am I missing here?
Re: [2005] Getting image from embedded resource
That's the ImageList doing that. What is the ColorDepth property of the ImageList set to?
Re: [2005] Getting image from embedded resource
It's "Depth8bit", so I guess it should be something better. Can I use any value?, or should I stick to something that will display properly on all computers?
32Bit looks perfect.
Re: [RESOLVED] [2005] Getting image from embedded resource
You should use the highest value that doesn't require you to downsample any of the contained images. If the highest resolution of any of the images is 24 bit then use 24 bit. If in doubt play it safe and use the highest.