我想编辑我的图片在我的Node.js应用程序在服务器端运行。此时,我已经成功地在我的图像上添加了文本。我想在此图像的左上角放置一个绿色矩形,并尝试了以下方法:
Jimp.read(`borderTop.png`, function (err, top) {
top.rotate(45);
Jimp.read(`img.png`, function (err, image) {
if (err) console.log(err);
image.blit(top, 430, -250);
Jimp.loadFont(`${__dirname}/../public/fonts/*.fnt`).then(function (font) {
image.print(font, 315 - ((16 * 13 ) / 2), 0, "Hello, world!");
image.write(finalName, (err) => {
return cb(null, `img.png`);
});
});
});
});
Run Code Online (Sandbox Code Playgroud)
这是有效的,但它正在删除我的图像边界下的部分。
我试过:
.png
文件我有一个包含两个年龄的猫鼬文档。参观景点的最低年龄和最大年龄。
我需要查询数据库以获取 0 到 2 岁之间的所有景点。
但这行不通:
"ageMin": {
"$lte": 2
},
"ageMax": {
"$gte": 0
},
Run Code Online (Sandbox Code Playgroud)
因为我的吸引力大多在0到99之间。
为了帮助您形象化,我举了一个例子:
attractionOne: {
name: "Deadly Looping",
ageMin: 12,
ageMax: 99
}
attractionTwo: {
name: "Easy Ladybug",
ageMin: 0,
ageMax: 12
}
Run Code Online (Sandbox Code Playgroud)
谢谢。