当前位置:网站首页>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();
}
边栏推荐
- [quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
- Leetcode 182 Find duplicate email (2022.07.01)
- [paid promotion] collection of frequently asked questions, recommended list FAQ
- 华为游戏初始化init失败,返回错误码907135000
- Special topic of binary tree -- acwing 19 The next node of the binary tree (find the successor of the node in the tree)
- Overview of integrated learning
- Hdu1236 ranking (structure Sorting)
- Matlab processing of distance measurement of experimental electron microscope
- One trick to quickly realize custom application titlebar
- Implement custom drawer component in quick application
猜你喜欢

快应用中实现自定义抽屉组件

全网显示 IP 归属地,是怎么实现的?

【快应用】text组件里的文字很多,旁边的div样式会被拉伸如何解决

1287_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
![[AGC] build service 3 - authentication service example](/img/89/63f367270e806e89c4ff92360dc3c5.png)
[AGC] build service 3 - authentication service example
![二叉树专题--洛谷 P3884 [JLOI2009]二叉树问题(dfs求二叉树深度 bfs求二叉树宽度 dijkstra求最短路)](/img/c2/bb85b681af0f78b380b1d179c7ea49.png)
二叉树专题--洛谷 P3884 [JLOI2009]二叉树问题(dfs求二叉树深度 bfs求二叉树宽度 dijkstra求最短路)

HDU1236 排名(结构体排序)

一招快速实现自定义快应用titlebar

JSP webshell free -- the basis of JSP
![[applinking practical case] share in app pictures through applinking](/img/12/5616f1fa55387b81e25e55a98022b9.png)
[applinking practical case] share in app pictures through applinking
随机推荐
二叉树专题--AcWing 3540. 二叉搜索树建树(实用板子 构建二叉搜索树 并输出前、中、后序遍历)
PCL 投影点云
[applinking practical case] share in app pictures through applinking
华为联机对战服务玩家掉线重连案例总结
[ark UI] implementation of the startup page of harmonios ETS
Shell programming 01_ Shell foundation
实验电镜距离测量之Matlab处理
一.STM32的开发环境,keil5/MDK5.14安装教程(附下载链接)
[play with FPGA learning 5 in simple terms ----- reset design]
Hdu1234 door opener and door closer (water question)
[play with FPGA learning 4 in simple terms ----- talk about state machine design]
洛谷 P1892 [BOI2003]团伙(并查集变种 反集)
618 what is the secret of dominating the list again? Nike's latest financial report gives the answer
2022-06-17
Jsp webshell Free from killing - The Foundation of JSP
Oracle notes
Leetcode+ 76 - 80 storm search topic
洛谷 P4281 [AHOI2008]紧急集合 / 聚会(树上倍增 LCA)
PCL projection point cloud
二叉树专题--洛谷 P1229 遍历问题(乘法原理 已知前、后序遍历求中序遍历个数)