如何将流中的图像另存为 Jpeg



此代码段以与上传图像相同的格式保存图像,

thumbImg.Save(targetPath, image.RawFormat);

而不是图像。原始格式如何将其另存为 jpeg

对于Windows Phone 8.1,我发现以下内容运行良好。在您想要的任何路径上创建 TempStorageFile,然后像这样传入图像的流:

var fileStream = await TempStorageFile.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);
await RandomAccessStream.CopyAsync(imageStream, fileStream);

尝试 ImageFormat.Jpeg

thumbImg.Save(targetPath, ImageFormat.Jpeg);

最新更新