简体   繁体   中英

How can i convert a 22bpp gif image to a 32bpp gif image in C#?

I am using picturebox control in WPF to show a Gif image. Since i am using AllowTransperency="True", picturebox control is not getting displayed. As per this stackoverflow article i have to convert my 22bpp image to 32bppimage. How can i do that? Kindly advice.

<Window Loaded="Window_Loaded" VeritcalAlignment="Center" AllowTransperency="True" Background="Transparent">

<border Background="Transpernt" BorderThickness="0">

<Grid>
<wfi:WindowsFormsHost Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center">

<winForms:PictureBox x:Name="myImage"></winForms:PictureBox>                  </wfi:WindowsFormsHost>

Code Behind

myImage.Image = @"C:\MyImage.Gif";

Please help. Thanks a lot for your help and time in advance.

Take a look at GifBitmapEncoder . One solution would be iterate over each frame and convert each bitmap.

Also, take a look at NGif , an open source library. It may suit you needs more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM