当前位置:网站首页>Resources读取2d纹理 转换为png格式
Resources读取2d纹理 转换为png格式
2022-07-02 07:33:00 【心前阳光】
文档
操作步骤
- 图片开启 Read/Write Enable
- 使用Texture2D的EncodeToPNG方法将纹理转换为字节数组
- 使用文件流,存储图片到其他位置
string path = Application.streamingAssetsPath + "/NewFolder";//设置存储路径
Texture2D tx = Resources.Load<Texture2D>("girl");//加载图片
if (tx)
{
byte[] bytes;
bytes = tx.EncodeToPNG();//转换为PNG
FileStream stream = new FileStream(path + "/test.png", FileMode.OpenOrCreate);
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}
边栏推荐
- 二叉树专题--AcWing 47. 二叉树中和为某一值的路径(前序遍历)
- V2X-Sim数据集(上海交大&纽约大学)
- MongoDB 学习整理(条件操作符,$type 操作符,limit()方法,skip() 方法 和 sort() 方法)
- Binary tree topic -- p1030 [noip2001 popularization group] find the first order
- 正则及常用公式
- K-d tree and octree of PCL
- 二叉树专题--AcWing 19. 二叉树的下一个节点(找树中节点的后继)
- 首份中国企业敏捷实践白皮书发布| 附完整下载
- PCL extracts a subset from a point cloud
- Special topic of binary tree -- acwing 47 Path with a certain value in binary tree (preorder traversal)
猜你喜欢
二叉树专题--AcWing 1589. 构建二叉搜索树
Luogu p5536 [xr-3] core city (greed + tree DP looking for the center of the tree)
三.芯片启动和时钟系统
实验电镜距离测量之Matlab处理
全网显示 IP 归属地,是怎么实现的?
Overview of integrated learning
2022-06-17
二叉树专题--AcWing 3540. 二叉搜索树建树(实用板子 构建二叉搜索树 并输出前、中、后序遍历)
flink二开,实现了个 batch lookup join(附源码)
[SUCTF2018]followme
随机推荐
Analysis of hot spots in AI technology industry
Hdu1228 a + B (map mapping)
【AGC】如何解决事件分析数据本地和AGC面板中显示不一致的问题?
TIPC 寻址2
Is the account above changtou school safe?
【深入浅出玩转FPGA学习5-----复位设计】
Disassembling Meitu SaaS: driving the plane to change the engine
计算序列之和
The URL in the RTSP setup header of the axis device cannot take a parameter
Nodejs+express+mysql simple blog building
二叉树专题--AcWing 47. 二叉树中和为某一值的路径(前序遍历)
MySQL lethal serial question 3 -- are you familiar with MySQL locks?
Common methods of JS array
【AI应用】海康威视iVMS-4200软件安装
【付费推广】常见问题合集,推荐榜单FAQ
Implement custom drawer component in quick application
学习open62541 --- [66] UA_String的生成方法
PCL之滤波
集成学习概览
Use of vscode tool