當前位置:九游会j9娱乐平台-九游ag登录中心网址 » 操作系統 » 二維碼生成器源碼

二維碼生成器源碼-九游会j9娱乐平台

發布時間: 2022-01-07 23:46:45

a. vfp怎樣生成二維碼的開源代碼

環境:visual studio 2013
准備工作:引入一個dll——thoughtworks.qrcode
dll作用:封裝成熟的二維碼演算法等(有包不用自己寫的,我覺得都是大仙)
引入dll方法:
(1)打開「程序包管理控制台」(視圖——其他窗口——程序包管理控制台)
(2)install-package -projectname 你的項目名稱 thoughtworks.qrcode
(3)等待等待等待等待。。。。。。。然後裝完。

生成二維碼的核心代碼:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//mappath:網站根目錄
//filesavefolder:相對路徑
//link:鏈接或者文本
public static string
generatelinkqrcode
(string mappath, string filesavefolder, string link)
{
qrcodeencoder qr = new qrcodeencoder()
{
//編碼
qrcodeencodemode = qrcodeencoder.encode_mode.byte,
//二維碼縮放
qrcodescale = 4,
//數字越小,二維碼密度越小,
//可容納的文本越少
qrcodeversion = 4,
//
qrcodeerrorcorrect = qrcodeencoder.error_correction.m
};

//存放路徑處理
if (!directory.exists(mappath filesavefolder))
{
directory.createdirectory(mappath filesavefolder);
}

//給二維碼圖片取名字
//規則可任意修改
string filename = "qrcode"
datetime.now.tostring("yyyymmddhhmmss")
隨機字元串
".png";

//存放二維碼的絕對路徑
string filepath = mappath filesavefolder filename;

//生成二維碼圖片放在內存中
bitmap bitmap = qr.encode(link);
//保存圖片到伺服器磁碟(本地保存)
bitmap.save(filepath, system.drawing.imaging.imageformat.png);
//准備返回二維碼圖片相對路徑
string result = filesavefolder filename;
result = "/" result.replace(@"\", "/");
//輸出結果,就是二維碼的路徑
return result;
}
本回答由提問者推薦評論 0 0

j_oin
採納率:42% 擅長: javascript c#/.net 編程語言 html/css
其他回答
新建一個window應用程序,然後引入.net二維碼類庫(開源的類庫,可從網上下載):
核心代碼如下:

using system;

using system.collections.generic;

using system.componentmodel;

using system.data;

using system.drawing;

using system.linq;

using system.text;

using system.windows.forms;

namespace winqrcode

{

using thoughtworks.qrcode.codec;

using thoughtworks.qrcode.codec.data;

using thoughtworks.qrcode.codec.util;

using system.io;

using pdftoimage;

public partial class form1 : form

{

public form1()

{

initializecomponent();

}

///



/// 編碼

///


///

///

private void button1_click(object sender, eventargs e)

{

if (this.textbox1.text != "")

{

cursor.current = cursors.waitcursor;

if (textbox1.text.trim() == string.empty)

{

messagebox.show("不能為空.");

return;

}

qrcodeencoder qrcodeencoder = new qrcodeencoder();

qrcodeencoder.qrcodeencodemode = qrcodeencoder.encode_mode.byte;

qrcodeencoder.qrcodescale = 4;

qrcodeencoder.qrcodeversion = 7;

qrcodeencoder.qrcodeerrorcorrect = qrcodeencoder.error_correction.m;

system.drawing.image image;

string data = textbox1.text;

//編碼

image = qrcodeencoder.encode(data);

//圖片顯示

this.picturebox1.image = image;

cursor.current = cursors.default;

}

}

///

/// 解碼

///


///

///

private void button2_click(object sender, eventargs e)

{

cursor.current = cursors.waitcursor;

bitmap b = this.picturebox1.image as bitmap;

try

{

qrcodedecoder decoder = new qrcodedecoder();

//解碼

string decodedstring = decoder.decode(new qrcodebitmapimage(b));

//顯示解碼信息

this.lbl解碼信息.text = decodedstring ;

}

catch (exception ex)

{

messagebox.show(ex.message);

}

cursor.current = cursors.default;

}

private void form1_load(object sender, eventargs e)

{

}

}

}

b. 求個c#生成的二維碼源碼,文本、圖片、名片都可以生成的二維碼,類似微信。生成的二維碼中間有圖片的

同求,感謝![email protected]

c. 二維碼生成器的製作原理是什麼

製作原理:二維碼其實就是由很多0、1組成的數字矩陣。二維條碼/二維碼是用某種特定的幾何圖形按一定規律在平面分布的黑白相間的圖形記錄數據符號信息的。

在代碼編制上巧妙地利用構成計算機內部邏輯基礎的「0」、「1」比特流的概念,使用若干個與二進制相對應的幾何形體來表示文字數值信息。

通過圖象輸入設備或光電掃描設備自動識讀以實現信息自動處理:它具有條碼技術的一些共性,每種碼制有其特定的字元集。

每個字元佔有一定的寬度;具有一定的校驗功能等。同時還具有對不同行的信息自動識別功能、及處理圖形旋轉變化等特點。 二維條碼/二維碼能夠在橫向和縱向兩個方位同時表達信息,因此能在很小的面積內表達大量的信息。

(3)二維碼生成器源碼擴展閱讀:

分類:

1、堆疊式/行排式二維碼

堆疊式/行排式二維條碼(又稱堆積式二維條碼或層排式二維條碼),其編碼原理是建立在一維條碼基礎之上,按需要堆積成二行或多行。

它在編碼設計、校驗原理、識讀方式等方面繼承了一維條碼的一些特點,識讀設備與條碼印刷與一維條碼技術兼容。

但由於行數的增加,需要對行進行判定,其解碼演算法與軟體也不完全相同於一維條碼。有代表性的行排式二維條碼有:code 16k、code 49、pdf417等。

2、矩陣式二維碼

短陣式二維條碼(又稱棋盤式二維條碼)它是在一個矩形空間通過黑、白像素在矩陣中的不同分布進行編碼。在矩陣相應元素位置上,用點(方點、圓點或其他形狀)的出現表示二進制「1」,點的不出現表示二進制的「0」,點的排列組合確定了矩陣式二維條碼所代表的意義。

矩陣式二維條碼是建立在計算機圖像處理技術、組合編碼原理等基礎上的一種新型圖形符號自動識讀處理碼制。具有代表性的矩陣式二維條碼有:code one、maxi code、qr code、 data matrix等。

d. 求一個用python easygui模塊編寫的二維碼生成器代碼,非常感謝

描述:我用的是py25,裝的是0.97版的easygui,就出現了你這個問題,而在py27上就沒有這個問題。
原因:這是語法問題,easygui使用的是高版本的python進行編譯的,except exception as inst:在py25裡面應該是except exception,inst:
解決方法:用替換法改成適應版本的語法比較麻煩,推薦用以下的解決辦法,一是下載低版本的easygui,二是用高版本的python(2.6及以上)。

e. 如何製作二維碼生成器,給個詳細的過程,需要啥軟體

製作二維碼生成器的具體步驟如下:

1、首先打開微信,點擊打開微信發現中的「小程序」選項。

f. 誰有二維碼生成的源代碼(java版本)的,能提供些嗎

可以考慮使用圖形繪制來解決二維碼的生成問題,使用實例如下:

生成二維碼
packagenet.qrcode;

importjava.awt.image.bufferedimage;
importjava.io.file;
importjava.io.ioexception;
importjava.io.outputstream;

importjavax.imageio.imageio;

importcom.google.zxing.common.bitmatrix;

{

//私有不可更改的變數:生成二維碼圖片的顏色
privatestaticfinalintblack=0xff000000;
privatestaticfinalintwhite=0xffffffff;
//空的構造方法
publicmartixtoimagewriter(){
//todoauto-generatedconstructorstub
}
/**
*靜態方法
*bufferedimage是image的一個子類,bufferedimage生成的圖片在內存里有一個圖像緩沖區,利用這個緩沖區我們可以很方便的操作這個圖片,
*通常用來做圖片修改操作如大小變換、圖片變灰、設置圖片透明或不透明等。
*@parammatrix編碼形式
*@return
*/
(bitmatrixmatrix)
{
//圖片的寬度和高度
intwidth=matrix.getwidth();
intheight=matrix.getheight();
//bufferedimage.type_int_rgb將圖片變為什麼顏色
bufferedimageimage=newbufferedimage(width,height,bufferedimage.type_int_rgb);
for(intx=0;x{
for(inty=0;y{
image.setrgb(x,y,matrix.get(x,y)?black:white);
}
}
returnimage;
}
/**
*靜態方法用於生成圖片
*@parammatrix編碼形式
*@paramformat圖片類型
*@paramfile文件(圖片路徑,圖片名稱)
*@throwsioexception
*/
publicstaticvoidwritetofile(bitmatrixmatrix,stringformat,filefile)throwsioexception
{
bufferedimageimage=tobufferedimage(matrix);
if(!imageio.write(image,format,file))
{
thrownewioexception("couldnotwriteanimageofformat" format "to" file);
}
}
/**
*輸出
*@parammatrix
*@paramformat
*@paramstream
*@throwsioexception
*/
publicstaticvoidwritetostream(bitmatrixmatrix,stringformat,outputstreamstream)throwsioexception
{
bufferedimageimage=tobufferedimage(matrix);
if(!imageio.write(image,format,stream))
{
thrownewioexception("couldnotwriteanimageofformat" format);
}
}
}

測試二維碼是否生成成功
packagenet.qrcode;

importjava.io.file;
importjava.util.arraylist;
importjava.util.hashmap;
importjava.util.list;
importjava.util.map;

importcom.google.zxing.barcodeformat;
importcom.google.zxing.encodehinttype;
importcom.google.zxing.multiformatwriter;
importcom.google.zxing.common.bitmatrix;

publicclasstwodimensioncode{

publicstaticvoidmain(string[]args){
try
{
system.out.println("請輸入您要生成二維碼的信息");
scannerinput=newscanner(system.in);
stringcontent=input.next();
stringpath="c:\users\administrator\desktop\二維碼圖片庫";
=newmultiformatwriter();
maphints=newhashmap();
hints.put(encodehinttype.character_set,"utf-8");
//按照指定的寬度,高度和附加參數對字元串進行編碼
//生成二維碼
bitmatrixbitmatrix=multiformatwrite.encode(content,barcodeformat.qr_code,400,400,hints);
filefile1=newfile(path,userid ".jpg");
//寫入文件
martixtoimagewriter.writetofile(bitmatrix,"jpg",file1);
system.out.println("二維碼圖片生成成功!");
}
catch(exceptione)
{
e.printstacktrace();
}
}
}

g. 求:asp生成二維碼的源碼。

其實是一個誤會,二維碼本身存什麼無所謂,只不過編碼規則不一樣而已。軟能動力的網站上好像有免費用控制項,可以用任何一種語言調用。他們家是專業做二維碼的,號稱從2005年就開始研發了。如果你不知道怎麼樣編碼,你就給他們的技術打電話好了

h. 如何製作二維碼生成器 中間 源碼 csdn c

碼工具網上有製作二維碼的工具。

i. 二維碼生成程序c語言源代碼

1、二維碼有很多種標准,可以控制存儲數據的信息量,也可以控制容錯的數據量[使得部分污損的二維碼可以被正常讀齲通常的做法是調用二維碼設計方提供的組件,如果是自己生成二維碼,應該可以生成可以看起來很像的東西。

j. 如何製作二維碼生成器 帶logo 源碼 csdn c

去碼工具網上,有製作二維碼的工具,帶圖標。

熱點內容
sqlserver如何切換主備伺服器 發布:2024-07-17 16:23:02 瀏覽:297
mc18伺服器ip 發布:2024-07-17 16:23:02 瀏覽:377
仙境傳說手游腳本 發布:2024-07-17 16:09:24 瀏覽:690
matlab命令窗口和新建腳本 發布:2024-07-17 15:51:26 瀏覽:374
建ftp文件夾 發布:2024-07-17 15:51:26 瀏覽:954
魔獸撿物腳本 發布:2024-07-17 15:27:56 瀏覽:129
開發ip伺服器 發布:2024-07-17 15:24:42 瀏覽:387
安卓系統視頻製作哪個好用 發布:2024-07-17 15:10:47 瀏覽:210
androidapk結構 發布:2024-07-17 15:10:43 瀏覽:945
c語言指針的例子 發布:2024-07-17 15:08:01 瀏覽:768
网站地图