如何将文本添加到 gif node.js
How to add text to a gif node.js
嗨,我正在处理一个问题,我想得到一个 gif 让我们说 this (of course if needed it would be downloaded) to have text at the top saying "When i pee my pants" i have looked through google codegrepper and Whosebug 作为答案,但什么都没有
这个问题有解决办法吗?如果提供代码示例或纪录片,我们将不胜感激...
您可以使用 tenorjs 来获取 GIF。如果您只想使用某个 GIF,请下载该 GIF,并将其添加到您的文件中。
您可以使用 text-on-gif 之类的东西在 GIF 上显示文本。
text-on-gif
的基本用法:
const textOnGif = require("text-on-gif");
(async function(){
//get gif as buffer
var gifBuffer = await textOnGif({
file_path:"/path/file.gif", //path to local file or url
textMessage:"custom message"
});
console.log(gifBuffer)
//write gif as file
await textOnGif({
file_path:"/path/file.gif", //path to local file or url
textMessage:"custom message",
write_as_file:true,
getAsBuffer:false,
write_path:"path/gif-with-text.gif"
});
})();
嗨,我正在处理一个问题,我想得到一个 gif 让我们说 this (of course if needed it would be downloaded) to have text at the top saying "When i pee my pants" i have looked through google codegrepper and Whosebug 作为答案,但什么都没有
这个问题有解决办法吗?如果提供代码示例或纪录片,我们将不胜感激...
您可以使用 tenorjs 来获取 GIF。如果您只想使用某个 GIF,请下载该 GIF,并将其添加到您的文件中。
您可以使用 text-on-gif 之类的东西在 GIF 上显示文本。
text-on-gif
的基本用法:
const textOnGif = require("text-on-gif");
(async function(){
//get gif as buffer
var gifBuffer = await textOnGif({
file_path:"/path/file.gif", //path to local file or url
textMessage:"custom message"
});
console.log(gifBuffer)
//write gif as file
await textOnGif({
file_path:"/path/file.gif", //path to local file or url
textMessage:"custom message",
write_as_file:true,
getAsBuffer:false,
write_path:"path/gif-with-text.gif"
});
})();