日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

中文汉字注音,汉字转拼音,支持图片识别文字,支持结果转图下载,附上小程序核心源码

發布時間:2023/12/15 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 中文汉字注音,汉字转拼音,支持图片识别文字,支持结果转图下载,附上小程序核心源码 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

“文字注音”小程序在微信、字節跳動、支付寶、QQ等小程序平臺同步上線,微信、頭條、抖音、支付寶、QQ中搜索“文字注音”即可獲得。

一、功能

漢字轉拼音,支持圖片識別文字,支持結果轉圖下載。該款小程序能夠輕松將文字注音后輸出,無需授權,無需注冊,即來即用。你還可以用它來識別圖片中的文字后注音,或者隨時拍照后識別文字再注音。同時支持注音完成后復制拼音,支持將結果保存成圖片下載到手機本地。歡迎掃描下面的各平臺得小程序碼來嘗試一下。

二、平臺小程序碼

微信小程序抖音/頭條小程序QQ小程序

三、核心源碼:

原文鏈接:https://www.i847.cn/article/3033.html

部分源碼預覽:

save:function(){var _that = this;_that.down = true;//先設置canvas得高度_that.canvasHeight = _that.canvasStaticHeight;_that.showCanvas = true;setTimeout(function(){var ctx = uni.createCanvasContext("canvas",_that);ctx.rect(0, 0, _that.canvasWidth, _that.canvasHeight);ctx.setFillStyle('white');ctx.fill();ctx.setFillStyle('black');// 字體大小ctx.setFontSize(14);var fontHeight = 14;// 寬度var width = _that.canvasWidth;// 橫向間隔var transverse = 9;// 縱向小間隔var portraitSmall = 4;// 縱向大間隔var portraitBig = 7;// 外間距var padding = 20;// 橫向距離累計var transverseCumulative = padding;// 縱向距離累計var portraitCumulative = padding;var lineHeight = portraitSmall + portraitBig + (fontHeight*2);for(var i=0;i<_that.list.length;i++){// canvas高度變化if(i==0){_that.canvasHeight = portraitCumulative + lineHeight;setTimeout(function(){},10);}var item = _that.list[i];var metrics = ctx.measureText(item.pinyin);var tempX = transverseCumulative + transverse + metrics.width;if(tempX > (width-padding) || item.pinyin=="enter"){transverseCumulative = padding;portraitCumulative = portraitCumulative + lineHeight;_that.canvasHeight = portraitCumulative + lineHeight;setTimeout(function(){},10);}if(item.pinyin!="enter"){var x1;if(transverseCumulative==padding){x1 = transverseCumulative;}else{x1 = transverseCumulative + transverse;}var y1 = portraitCumulative;ctx.fillText(item.pinyin, x1, y1);var x2 = x1;var y2 = y1 + portraitSmall + fontHeight;ctx.fillText(item.value,x2, y2);transverseCumulative = x1 + metrics.width;}}ctx.draw();setTimeout(function(){uni.canvasToTempFilePath({width: _that.canvasWidth,height: _that.canvasHeight,destWidth: _that.canvasWidth * _that.pixelRatio,destHeight: _that.canvasHeight * _that.pixelRatio,canvasId: 'canvas',success: function(res) {uni.saveImageToPhotosAlbum({filePath: res.tempFilePath,success:function(){uni.showToast({title:"保存成功"})},complete:function(){_that.showCanvas = false;_that.down = false;}});},fail:function(e){console.log(e);_that.showCanvas = false;_that.down = false;}})},100);},100); }

?

總結

以上是生活随笔為你收集整理的中文汉字注音,汉字转拼音,支持图片识别文字,支持结果转图下载,附上小程序核心源码的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。