public Texture2D t2d;//用来设置像素的texture,像素为1920*1080
Texture2D texture = new Texture2D(384, 216, TextureFormat.RGBA32, true);//
for (int i = 0; i < texture.height; i++)//压缩图片
{
for (int j = 0; j < texture.width; j++)
{
Color color = t2d.GetPixel(j * 5, i * 5);
texture.SetPixel(j, i, color);
}
}
texture.Apply();
byte[] imagesst = texture.EncodeToJPG();
File.WriteAllBytes(filepathsst + "/" + lengthpicCam.ToString() + ".jpg", imagesst);
设置Texture像素
最新推荐文章于 2022-09-06 13:42:48 发布