AS3 - 将Tiff转换为png

时间:2017-09-18 15:26:31

标签: image actionscript-3 flash png tiff

我正在尝试使用AS3将Tiff文件转换为PNG文件。

var bytes:ByteArray = img.data as ByteArray;
var tiffDecoder:TIFF6Decoder = new TIFF6Decoder();

var pngSync:PNGEncoder = new PNGEncoder();

if( tiffDecoder.decode(bytes) ) 
{
    var bytesPNG:ByteArray = pngSync.encode(tiffDecoder.bitmapData);
    var tmp:File = File.createTempDirectory();
    img = FileUtils.writeFile(bytesPNG, tmp.nativePath + "/image.png");
}
else { Alert.show("Failed TIFF decoding"); }

但是解码功能会出现错误。

你知道另一个解决方案吗?
PHP的ImageMagik可能是一个经过深思熟虑的解决方案,但我需要在Windows和MacOS上安装相同的。

0 个答案:

没有答案