Convert JPG to PNG or other method of transparency

Feb 26 2005 11:54 PM
Simple questions: Before that: Thanks to Shruti Shrivastava for your Image Process example on this site. It really brought this application developer up to speed quickly in GDI+. Here's my overall goal: I want to take photos of objects in front of a green screen with my digital camera. The camera saves as jpg. I then want to open the jpg in a C# Windows form and make the green screen transparent. Using code from Shruti's example I was able to modify it to where I could alpha out any color in a png but because jpg doesn't have that ability, I'm stuck. Just so you know, performance is not important. Now the questions: Considering the jpg is 24bpp, I was hoping that using PixelFormat.Format32bppPArgb in the LockBits method would "add" those extra bytes for the alpha channel. It doesn't seem to be the case. What's the best way to do this. I'm now considering allocating enough memory for the jpg + the alpha and step though the jpg pixels, inserting the 3 bytes then a 255 in the 4th byte. Then when it's done save it out as a png. If I just sounded silly, I'm glad I made your day :-) Any advice. Thanks