① 如何將位元組數組轉化成圖片
dim picture(1 to 10) as picture
set picture(1)=loadpicture("d:\213.jpg")
這樣,數組picture(1)就等於那張圖片了,像載入圖片那樣
② C++如何將一個string格式的數組存為png圖片
我以前弄過一次,我的想法很簡單就是創建一個xxx.png文件,然後把string寫進去保存
具體一點就是:使用fopen(或者FILE文件操作)以w+或者a+模式打開一個xxx.png,它不存在的話,自然就會創建一個空文件,然後fwrite(或者其他文件寫操作)進去,然後保存。
你可以嘗試一下
③ android如何由數組保存成圖片並保存在SD卡上
Bitmap bm = BitmapFactory.decodeByteArray(byte[] data, int offset, int length);別忘了判斷數組是不是為空。
保存。。。。
public void saveFile(Bitmap bm, String fileName) throws IOException {
private final static String ALBUM_PATH
= Environment.getExternalStorageDirectory() + "/download_test/";
File dirFile = new File(ALBUM_PATH);
if(!dirFile.exists()){
dirFile.mkdir();
}
File myCaptureFile = new File(ALBUM_PATH + fileName);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
}
④ java中如何將位元組數組轉化成圖片
java將byte數組轉換成圖片,可以File和IO操作來完成,實例如下:
//byte數組到圖片到硬碟上 public void byte2image(byte[] data,String path){ if(data.length<3||path.equals("")) return;//判斷輸入的byte是否為空 try{ FileImageOutputStream imageOutput = new FileImageOutputStream(new File(path));//打開輸入流 imageOutput.write(data, 0, data.length);//將byte寫入硬碟 imageOutput.close(); System.out.println("Make Picture success,Please find image in " + path); } catch(Exception ex) { System.out.println("Exception: " + ex); ex.printStackTrace(); } }
⑤ 如何把16進制數組轉化為圖片
先轉換成BMP圖片,就是先寫好文件頭,再把數組寫到後頭