TinyCLR PNG Support

Is there any chance for PNG Support?

I’ve tried this MakeTransparaent and it doesn’t work well with certain images…

Thanks

Can you show us your code? and send us your image?

I have attached the original image, along with what it looks like. You can see the bleed around the edges of the icon. This is based on the GHI example.

True PNG/transparency support would be nice :slight_smile:

var gfx = Graphics.FromImage(icon);

gfx.MakeTransparent(0xFFFFFF);  // MakeTransparent is only available from TinyCLR OS rc2

this.bitmapImage = BitmapImage.FromGraphics(gfx);

down-arrow

Your image does not have pure white(FFFFFF). You can fix the image and it should look just fine. The easiest way in this case is to increase contrast to the max.

Here is your image if i pour red in it using microsoft paint. Looks exactly like you are seeing on TinyCLR. So once oyu fix your image it will look amazing! Here an advice, do NOT use white or black as transparency. Use some strong color that you can easily see.

ea2397ff84ae4342b1805dbb06e5febcfdd4f6e1

Thanks Gus, I will give it a go! Will see if I can learn to use gimp :grimacing:

Cheers.

Update… So every time I save a JPG (no matter what) it loses some of it’s detail (meaning you get the shadowing that prevents the transparency)

I tried saving as a BMP and GIF (the detail remains) however neither will render. I can’t attach the bmp (forum won’t let me). Here is the GIF and code. The code loads fine if it’s a jpg, but won’t if gif or bmp. Am I missing something?

Bitmap testBitmap = Resources.GetBitmap(Resources.BitmapResources.download);

download

Correct. JPG is lossy compression. This normal and expected!

This is a different question now, unrelated to this topic, correct?

When you save you BMP you have the option for color depth and not every format is supported in TinyCLR. Try a different color depth when saving and test again please.

Got it situated, I think.

Thanks for your help Gus

1 Like