本文主要介绍如何生成节点(节点文本是什么意思),下面一起看看如何生成节点(节点文本是什么意思)相关资讯。
今天,老板要求在服务器上创建一个邀请卡。良好的...最简单的就是拿这个:结果更惨。红宝石 s后端做了一个html图说太慢了。我的下一个坑。所以在你睡觉之前,做一个简单的认识。解决了将文本转换为svg合并node.js的图像相关车轮图像轻量级跨平台图像编解码器库,不需要安装额外的依赖文本到svg到svg svg2png svg的png图像样本代码;const fs = required( ;fs);const image = required( ;图片);const texttosvg = required( ;文本到svg);const svg2png =必选(svg 2 png);;const 承诺=需要。;蓝鸟);promise . promisifyall(fs);const texttosvg = texttosvg . load sync( ;字体/温泉驿微米黑。ttf);const sourceimg = image。;。/i/webwxgetmsgimg . jpg);const swidth = source img . width;const she ight = source img . height;consts vg 1 = texttosvg . get svg( ;魏长青大家说说应用,{x: 0,y: 0,fontsize: 24,host:最重要,});constsvg2 = texttosvg。getsvg( ;邀请你参加,{x: 0,y: 0,fontsize: 16,主持人:最重要,});consts vg 3 = t: 32,主持人:最重要,});promise . co routine(function * generateinvationcard{)const target img 1 path = ;。/i/1。pngconst targetimg2path = 。/i/2。pngconst targetimg3path = 。/i/3。pngconst targetimg4path = 。/i/二维码。jpgconst {work,2,buffer3} =输出承诺。all (svgpng (svg1),svg2png(svg2),svgpng (svg3),});产出承诺。all (fs.writefile async(目标img1path,work),fs.writefile async(目标img2path,2),fs.writefile async(目标img3path,buffer3),});const target 1 img = image(target 1 path);const t1 width = target 1 img . width;const t1 height = target 1 img . height;const offset x1 =(swid th-t1 width)/2;const offsety1 = 200const target 2 img = image(target 2 path);const t2 width = target 2 img . width;const t2 height = target 2 img . height;const offset x2 =(swid th-t2 width)/2;const offsety2 = 240const target 3 img = image(target mg 3 path);const t3 width = target 3 img . width;const t3 height = target 3 img . height;const offsetx 3 =(swid th-t3 width)/2;const offsety3 = 270const target 4 img = image(target 4 path);const t4 width = target 4 img . width;const t4 height = target 4 img . height;const offset x4 =(swidth-t4 width)/2;const offsety4 = 400图像(sourceimg) (target1img。绘画,offsetx1,offsety1) (target2img)。绘画,偏位tx2,偏移量2)(目标3毫克.绘画,offsetx3,offsety3) (target4img)。painting,offsetx4,offsety4) save(,{,{ mass:90 });})(捕获)(e = console . error(e)););注意:文本到svg需要中文字体的支持,否则中文会很混乱。我的破电脑只用了500多毫秒。感觉分享出来就够了,想给你一个参考。以上是本文的全部内容,希望能对你有所帮助,也希望你多多支持。
了解更多如何生成节点(节点文本是什么意思)相关内容请关注本站点。
5s联通卡信号差怎么办4310m和5300u(i53470和10400f差距有多大)抖音退货订单号怎么填写才正确(抖音退货订单号怎么填写啊)中兴手机恢复出厂设置怎么弄,zte中兴手机恢复出厂设置联想笔记本突然不开机了按什键固态 缓存,买SSD固态硬盘时那个缓存数值 是用来干什么的6000预算台式电脑配置,求6000左右的台式机配置清单iphone xs max关机不了(iphonexsmax没法关机)