We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
private imageWatermark(file: Express.Multer.File, watermark: string) { const { PassThrough } = stream; return new Promise(async (resolve, reject) => { try { const gifStream = new PassThrough(); gifStream.end(file.buffer); const outputStream = new PassThrough(); const outputBuffers: Buffer[] = []; // 转义字符串 const escapedWatermark = watermark .replace(/:/g, '\\:') .replace(/\//g, '\\/') .replace(/ /g, '\\ ') .replace(/@/g, '\\@'); ffmpeg(gifStream) .outputOptions([ `-vf`, `drawtext=text='${escapedWatermark}':x=(w-tw-10):y=(h-th-10):fontsize=12:[email protected]`, ]) .toFormat('png') .on('error', (err) => reject(err)) .pipe(outputStream); outputStream.on('data', (chunk: Buffer) => { outputBuffers.push(chunk); }); outputStream.on('end', () => resolve(Buffer.concat(outputBuffers))); } catch (error) { reject(error); } }); }
(note: if the problem only happens with some inputs, include a link to such an input file)
Get one file buffer
Error: Output format png is not available
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Version information
Code to reproduce
(note: if the problem only happens with some inputs, include a link to such an input file)
Expected results
Get one file buffer
Observed results
Error: Output format png is not available
The text was updated successfully, but these errors were encountered: