如何使用gm更改添加在图像上的文本的字体粗细

问题描述

我正在使用gm在图像上添加文本。现在,我想使其变粗,但我没有选择更改字体粗细的选项。任何帮助表示赞赏。

As of Android 5.0 (API 21) you can also assign the android:theme for a view

解决方法

您可以使用如下所示的gm.in()自定义参数

const gm = require('gm').subClass({imageMagick: true});
const imageUrl = 'image_url'
const text = 'Some_text';
const image = gm(`${imageUrl}`)
            .resize(518,500)
            .fill('#f2f2f2')
            .font('Arial',14) 
            .in('-weight','Bold')
            .drawText(115,470,`${text}`);
image.write(`result.png`,err => {
  if(err) return console.error(err);
  console.log('done');
});

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...