当前位置:网站首页>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();
}
边栏推荐
- TIPC协议
- Implement custom drawer component in quick application
- 【AppLinking实战案例】通过AppLinking分享应用内图片
- Leetcode 182 Find duplicate email (2022.07.01)
- Thanos Receiver
- Disassembling Meitu SaaS: driving the plane to change the engine
- 如何用list组件实现tabbar标题栏
- [AGC] how to solve the problem that the local display of event analysis data is inconsistent with that in AGC panel?
- 二叉树专题--AcWing 47. 二叉树中和为某一值的路径(前序遍历)
- JVM garbage collector
猜你喜欢

华为应用市场应用统计数据问题大揭秘

Special topic of binary tree -- acwing 47 Path with a certain value in binary tree (preorder traversal)

Overview of integrated learning

Matlab processing of distance measurement of experimental electron microscope

QT学习日记7——QMainWindow
![[play with FPGA learning 5 in simple terms ----- reset design]](/img/57/816a59787259dc32b52897c069e1a6.png)
[play with FPGA learning 5 in simple terms ----- reset design]

Uncover the secrets of Huawei application market application statistics

【AI应用】海康威视iVMS-4200软件安装

Disassembling Meitu SaaS: driving the plane to change the engine

How to transfer event objects and user-defined parameters simultaneously in Huawei express applications
随机推荐
Is the account above changtou school safe?
洛谷 P1892 [BOI2003]团伙(并查集变种 反集)
Special topic of binary tree -- acwing 3540 Binary search tree building (use the board to build a binary search tree and output the pre -, middle -, and post sequence traversal)
二叉树专题--AcWing 3540. 二叉搜索树建树(实用板子 构建二叉搜索树 并输出前、中、后序遍历)
TIPC Getting Started6
TIPC 寻址2
使用华为性能管理服务,按需配置采样率
MongoDB 学习整理(条件操作符,$type 操作符,limit()方法,skip() 方法 和 sort() 方法)
Luogu p1892 [boi2003] Gang (and search for variant anti set)
[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
Flick two open, realized a batch lookup join (with source code)
flink二开,实现了个 batch lookup join(附源码)
PCL 点云转深度图像
Special topic of binary tree -- acwing 18 Rebuild the binary tree (construct the binary tree by traversing the front and middle order)
Use of vscode tool
【深入浅出玩转FPGA学习5-----复位设计】
HDU1228 A + B(map映射)
[SUCTF2018]followme
【深入浅出玩转FPGA学习4----漫谈状态机设计】
Use Huawei performance management service to configure the sampling rate on demand