当前位置:网站首页>Resources reads 2D texture and converts it to PNG format
Resources reads 2D texture and converts it to PNG format
2022-07-02 11:14:00 【Sunshine in front of my heart】
file
Operation steps
- Picture on Read/Write Enable
- Use Texture2D Of EncodeToPNG Method to convert a texture into a byte array
- Using file streams , Store pictures to other locations
string path = Application.streamingAssetsPath + "/NewFolder";// Set storage path
Texture2D tx = Resources.Load<Texture2D>("girl");// Loading pictures
if (tx)
{
byte[] bytes;
bytes = tx.EncodeToPNG();// Convert to PNG
FileStream stream = new FileStream(path + "/test.png", FileMode.OpenOrCreate);
stream.Write(bytes, 0, bytes.Length);
stream.Close();
}
边栏推荐
- Calculate the sum of sequences
- The most detailed MySQL installation tutorial
- Openmldb meetup No.4 meeting minutes
- The working day of the month is calculated from the 1st day of each month
- 二叉树专题--AcWing 3384. 二叉树遍历(已知先序遍历 边建树 边输出中序遍历)
- Flink two Open, implement Batch Lookup join (attached source)
- Special topic of binary tree -- acwing 47 Path with a certain value in binary tree (preorder traversal)
- Leetcode 182 Find duplicate email (2022.07.01)
- js中给数组添加元素的方法有哪些
- Mongodb learning and sorting (condition operator, $type operator, limit() method, skip() method and sort() method)
猜你喜欢

金山云——2023届暑期实习

Mongodb learning and sorting (condition operator, $type operator, limit() method, skip() method and sort() method)

TIPC messaging3

Win11 arm system configuration Net core environment variable

Special topic of binary tree -- Logu p1229 traversal problem (the number of traversals in the middle order is calculated when the pre and post order traversals of the multiplication principle are know

How to transfer event objects and user-defined parameters simultaneously in Huawei express applications

二叉树专题--AcWing 1589. 构建二叉搜索树

I STM32 development environment, keil5/mdk5.14 installation tutorial (with download link)

二叉树专题--洛谷 P1229 遍历问题(乘法原理 已知前、后序遍历求中序遍历个数)

Special topic of binary tree -- acwing 18 Rebuild the binary tree (construct the binary tree by traversing the front and middle order)
随机推荐
主键策略问题
【深入浅出玩转FPGA学习3-----基本语法】
【IDEA】使用插件一键逆向生成代码
The most detailed MySQL installation tutorial
Thanos Receiver
Calculate the sum of sequences
通过券商经理的开户二维码开股票账户安全吗?还是去证券公司开户安全?
Jenkins installation
Appgallery connect scenario development practice - image storage and sharing
Filtering of PCL
实验电镜距离测量之Matlab处理
Verilog 和VHDL有符号数和无符号数相关运算
The working day of the month is calculated from the 1st day of each month
Jenkins安装
Leetcode 182 Find duplicate email (2022.07.01)
二叉树专题--AcWing 1497. 树的遍历(利用后、中序遍历,构建二叉树)
Pit of the start attribute of enumrate
ctf 记录
SQLite modify column type
Why does LabVIEW lose precision in floating point numbers