当前位置:网站首页>Convert local pictures to Base64 encoding
Convert local pictures to Base64 encoding
2022-04-23 22:06:00 【Juicy and flavorful】
Import required packages :
import java.io.*;
import java.util.Base64;
Use Java Convert to according to the address where the picture is saved locally Base64 code
/**
* Convert picture to Base64 code
* @param imgFile Images to be processed
* @return
*/
public static String ImgToBase64(String imgFile){
// Convert image file to byte array string , And carry out Base64 Encoding processing
InputStream in = null;
byte[] data = null;
// Read image byte array
try
{
in = new FileInputStream(imgFile);
data = new byte[in.available()];
in.read(data);
in.close();
}
catch (IOException e)
{
e.printStackTrace();
}
return new String(Base64.getEncoder().encode(data));
}
版权声明
本文为[Juicy and flavorful]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/113/202204232159112679.html
边栏推荐
- Maintenance of coherent PMB power supply of rofin laser hpc840
- Tear the Google SRE book by hand
- Spellman high voltage power supply maintenance xrm50p50x3768 power supply maintenance pcm70n120x451
- [※ leetcode refers to offer 46. Translate numbers into strings (medium)]
- Database Experiment 5 Security Language Experiment
- Online Excel to CSV tool
- Pytorch deep learning practice (3)
- Implementation of service fusing
- OpenFeign 组件说明
- This paper solves the cross domain problem of browser
猜你喜欢
1. Summary of GPIO control of nanopi M1 (Quanzhi H3) based on wiringpi
Error message: b04access.00f eve'. Read of address 000001B4
21. Basic usage of MariaDB
IIS cannot load * woff,*. woff2,*. Solution of SVG file
C winfrom DataGridView click on the column header can not automatically sort the problem
QT QML component library records owned by QML except basic components
Hystrix components
资本追逐Near生态
[leetcode refers to offer 52. The first common node of two linked lists (simple)]
Maintenance of coherent PMB power supply of rofin laser hpc840
随机推荐
Database Experiment 3 data update experiment
OpenFeign的细节展示
C list data paging
1. Summary of GPIO control of nanopi M1 (Quanzhi H3) based on wiringpi
consul 关闭健康监控检查
Easylaser laser shaft alignment instrument maintenance homocentric instrument maintenance E420
通过OpenFeign传递对象类型参数
Strictly, severely and quickly strengthen food safety supervision during the epidemic in Shanghai
2. GPIO control summary (kernel driver) of nanopi M1 (Quanzhi H3)
Oracle ora-01033: Oracle initialization or shutdown in progressprocess solution
Based on jsplumb JS to achieve multi list one to many connection effect
Hystrix组件
Oracle updates the data of different table structures and fields to another table, and then inserts it into the new table
MySQL back to table
Cancel the default open project setting of idea
Plato Farm元宇宙IEO上线四大,链上交易颇高
Database experiment I database definition and data import
A series of problems of C DataGridView binding list
Subcontracting of wechat applet based on uni app
世界读书日,腾讯安全推荐一份充电书单