Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
jprekopa  
#1 Posted : Monday, April 20, 2009 11:39:01 PM(UTC)
jprekopa

Rank: Newbie

Groups: Member
Joined: 12/18/2008(UTC)
Posts: 1

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?
tcrosbie  
#2 Posted : Tuesday, April 21, 2009 11:48:55 AM(UTC)
tcrosbie

Rank: Advanced Member

Groups: Member
Joined: 6/22/2008(UTC)
Posts: 27

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.
Tamila  
#3 Posted : Wednesday, April 22, 2009 6:34:59 PM(UTC)
Tamila

Rank: Advanced Member

Groups:
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
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:
Code:
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();

Edited by user Wednesday, April 22, 2009 6:37:15 PM(UTC)  | Reason: Not specified

Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.