This project has moved and is read-only. For the latest updates, please go here.

Convert non-transparent TIFF to transparent PNG

Jun 12, 2015 at 5:46 PM
I am new to Magick.NET. How do you convert a TIFF image to a transparent PNG?

Here's what I have so far.
using (magickImage = new MagickImage(@"c:\input.tif")) 
{
        magicImage.Write(@"c:\output.png");
}
Jun 12, 2015 at 9:34 PM
Does your original tif image contain transpareny?
Jun 13, 2015 at 9:36 PM
No, it does not.
Jun 13, 2015 at 11:28 PM
Then why do you want to add transparency? Do you want to change a specific color to transparent? You can do that with the Opaque method of MagickImage.
Jun 13, 2015 at 11:36 PM
Edited Jun 13, 2015 at 11:51 PM
The transparency is needed for publishing purposes. I want to change "white" to transparent.

This did the trick.
using (magickImage = new MagickImage(@"c:\input.tif")) 
{
        magicImage.Opaque(new MagickColor("#FFF"), MagickColor.Transparent);
        magicImage.Write(@"c:\output.png");
}
Thanks!