transparent GIF issue

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
slee1997
Posts: 2
Joined: 2018-11-26T19:03:40-07:00
Authentication code: 1152

transparent GIF issue

Post by slee1997 »

Hi Everyone.
I am trying to use Magick.NET to convert a BITMAP into a transparent GIF and below is my code:

Code: Select all

                 using (MagickImage img = new MagickImage("C:\\TEST.bmp"))
                 {
                            img.Format = MagickFormat.Gif;
                            img.Transparent(MagickColor.FromRgb(255, 255, 255));
                            img.Write("C:\\TEST.gif");
                 } 
Everything is fine but the transparent part becomes 'black' if I view the output GIF using the tool does not support 'transparency' such as MS Paint, so is it possible to turn the 'black' color into other colors?

Thanks a lot!
Regards,
Stephen
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: transparent GIF issue

Post by dlemstra »

Can you share your input file?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
slee1997
Posts: 2
Joined: 2018-11-26T19:03:40-07:00
Authentication code: 1152

Re: transparent GIF issue

Post by slee1997 »

Hi,

I have changed my code to use 'convert' command directly and the problem is solved:

Code: Select all

convert TEST.gif -transparent "rgb(255,255,255)" -transparent-color "rgb(255,255,255)" TEST.gif
Thanks!
Stephen
Post Reply