我正在尝试将 RawImage 转换为数组字节(bytes []),但 RawImage 没有 encondePNG 或其他东西来获取 RawImage 的字节,知道如何获取字节数组吗?
public class RegistryScreen : UIScreen
{
Texture2D pickedImage;
public RawImage[] getRawImageProfile;
public void ChangeIconImage()
{
PickImageFromGallery();
//WebService
mygetImageProfileRequestData = new getImageProfileRequestData();
//this is the problem
mygetImageProfileRequestData.image = getRawImageProfile[0].texture;
}
public void PickImageFromGallery(int maxSize = 1024)
{
NativeGallery.GetImageFromGallery((path) =>
{
if (path != null)
{
// Create Texture from selected image
pickedImage = NativeGallery.LoadImageAtPath(path, maxSize);
////Sust. texture in image(Sprite)
for (int i = 0; i < getRawImageProfile.Length; i++)
{
getRawImageProfile[i].texture = pickedImage;
}
}
Debug.Log("getRawImage: " + getRawImageProfile[0].texture);
}, maxSize: maxSize);
}