canvas绘制图像 保存_如何使用Node.js和Canvas创建和保存图像

canvas绘制图像 保存

I share my blog posts on Twitter, and there’s been a time when I entertained myself drawing drawing an image for each blog post.

我在Twitter上分享我的博客文章,有时候我会为每个博客文章绘制图像来娱乐自己。

I set up Hugo so it uses an image named banner.png or banner.jpg stored in the post folder to be used as the Open Graph image, like this:

我设置了Hugo,以便它使用存储在post文件夹中的名为banner.pngbanner.jpg的图像用作“打开图形”图像,如下所示:

<meta property="og:image" content="https://flaviocopes.com/axios/banner.png" />

If a post has no image, I show my avatar instead:

如果帖子没有图片,我会显示我的头像:

<meta property="og:image" content="https://flaviocopes.com/img/avatar.png" />

There’s a problem: I stopped making those custom banner images a long time ago, and most of my posts don’t have a banner.

有一个问题:很久以前,我不再制作那些自定义的横幅图像,而且我的大多数帖子都没有横幅。

They all look the same on Twitter:

它们在Twitter上看起来都一样:

There’s no way I can make like 500 banner images at hand. I’ve had this thought of programmatically generating them since I saw Indie Hackers generating those images for forum blog posts (a great idea):

我不可能手头上制作500张横幅图像。 我曾经想到过以编程方式生成它们的想法,因为我看到独立黑客为论坛博客帖子生成了这些图像(一个好主意):

So after stumbling upon a nice inspiration for a ba

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值