2011-12-28 165 views
1

我使用c#中的SWFtoImage工具将swf文件转换为png图像。我能够成功转换文件,但问题是透明度。转换后的图像包含black background而不是transparent,如附图所示。将SWF转换为具有透明度的PNG图像

enter image description here

我怎样才能解决这个问题?由于该工具无法创建透明图像,是否有可能在.net上操纵converted png image并使其背景变得透明?

目前代码:

 //Namespace: BytescoutSWFToVideo; 

     // Create an instance of SWFToVideo ActiveX object 
     SWFToVideo converter = new SWFToVideo(); 

     // Register SWFToVideo 
     converter.RegistrationName = "demo"; 
     converter.RegistrationKey = "demo"; 

     // set input SWF file 
     converter.InputSWFFileName = @"D:\image2069.swf"; 

     // Enable trasparency 
     converter.RGBAMode = true; 

     // Extract all frames to .\Output sub-folder 
     converter.ConvertAllToPNG(@"D:\Result\"); 

This is the swf file

+0

为什么用'c#'和'.net'标记你的问题? – 2011-12-28 10:18:53

+0

因为我想让它在c#中完成; '有没有可能在.net上操作转换后的png图像并使其背景透明?' – NaveenBhat 2011-12-28 10:21:06

+0

好的,那么你现在的代码是怎么样的? – 2011-12-28 10:22:30

回答

3

我对SWFToImage了解不多。但该公司的网站包含以下注释演示代码(翻译成C#):

// Enable trasparency - set BEFORE setting input SWF filename 
converter.RGBAMode = true; 

所以可能你必须改变你的语句的顺序。

+0

非常感谢你,它像一个神奇的工作! – NaveenBhat 2011-12-28 11:33:28