1.加密(适用于本地图片:D://abc.jpg)
public static void main(String[] args) {
//String aa = GetImageStr1("D:/tttest/test.png");
//System.out.println(aa);
//GenerateImage(aa);
GenerateImage(path);
}
public static String GetImageStr1(String path) {
//将图片文件转化为字节数组字符串,并对其进行Base64编码处理
byte[] data = null;
try {
//读取图片字节数组
InputStream in = new FileInputStream(path);
//in = new FileInputStream(imgFile);
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
return new String(Base64