This project has moved. For the latest updates, please go here.

Convert non-transparent TIFF to transparent PNG

Jun 12, 2015 at 4: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");
}
Coordinator
Jun 12, 2015 at 8:34 PM
Does your original tif image contain transpareny?
Jun 13, 2015 at 8:36 PM
No, it does not.
Coordinator
Jun 13, 2015 at 10: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 10:36 PM
Edited Jun 13, 2015 at 10: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!