This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Losing transparency when saving TIFs

Loading a TIF with a transparent background and saving it loses the transparency layer. For example...

Bitmap bitmap = new Bitmap(@"c:\TestIn.tif");
bitmap.Save(@"c:\TestOut.tif");

The output image ends up with a black background in 5.0, and a white background in 5.1 (trial).

This seems like it should be something simple. Anyone know what I'm missing?
I'd be interested to hear what someone from Aurigma has to say. I've just performed a quick test on this in my app. Created a Tiff with a transparent background in Photoshop, saved the transparency in the file, then treated this file like I would a PNG with transparency, and I'm seeing the same result, (5.1 black background). It looks to me like Aurigma doesn't support transparency in tif.


The same source file saved as a PNG with transparency in the same test shows up correctly, ie. transparent background.
Hello,

Actually, .tif files do not lose the transparency layer (alpha channel). They just have the "unassociated" alpha channel. However, if you want to see white and gray small squares instead of black background I recommend you to use the following code sample:
Aurigma.GraphicsMill.Bitmap bmp = new Aurigma.GraphicsMill.Bitmap(@"c:\TestIn.tif");
Aurigma.GraphicsMill.Codecs.TiffWriter writer = new Aurigma.GraphicsMill.Codecs.TiffWriter(@"c:\TestOut.tif");
Aurigma.GraphicsMill.Codecs.TiffFrame frame = new Aurigma.GraphicsMill.Codecs.TiffFrame();
frame.SetBitmap(bmp);
writer.AlphaPremultiplied = true;
writer.AddFrame(frame);
writer.Dispose();
frame.Dispose();