我有一个图像SurfaceImageSource,我会将它转换为PNG。 我试过用这个工程: link将SurfaceImageSource转换为PNG
我试过用SharpDX库,但是没成功。
private void initialize()
{
StorageFolder folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("folder", CreationCollisionOption.OpenIfExists);
StorageFile imagePng = await folder.CreateFileAsync("file.png", CreationCollisionOption.ReplaceExisting);
if (imagePng != null)
{
//surfaceImageSource to PNG method
surfaceToPng(surfaceImage,imagePng);
}
}
private void surfaceToPng(SurfaceImageSource surface,StorageFile imagePng){
IRandomAccessStream stream = await imagePng.OpenAsync(FileAccessMode.ReadWrite);
//.....//
}
非常感谢您的回答。我的问题是:我已经有了一个SurfaceImageSource类型的图像。在你的代码中,你创建并绘制一个MyImageSource类型的新图像。我应该将我的SurfaceImageSource图像转换为MyImageSource,以便为我的图像使用方法SaveSurfaceImageToFile。但我没有成功。 – Andrea485