本文介绍了如何将WriteableBitmap保存为具有透明性的png图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从图像中裁剪出用于化身的圆形区域.我需要获取图像的像素byte []并以base64格式上传到服务器.不幸的是,方法SaveJpeg()不支持所选圆之外的透明度像素.我尝试了ImageTools库,但是除Windows Phone之外,没有其他平台无法从生成的byte []中创建png图像.有办法吗?

I crop the circular area from the image for the avatar. I need to get pixels byte[] of the image and upload to the server in base64 format. Unfortunately method SaveJpeg() does not support transparency pixels outside the selected circle. I tried ImageTools library, but no other platform except WindowsPhone unable to create png image from the resulting byte[]. Is there a way to do this?

推荐答案

没有平台API可以执行此操作. ToolStack PNG库提供了一种轻量级的解决方案.

There is no platform API to do this. The ToolStack PNG library presents a lightweight solution.

http://toolstack.com/libraries/pngwriter

这篇关于如何将WriteableBitmap保存为具有透明性的png图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 17:31