MCPcopy Create free account
hub / github.com/Maccoder3/MAC-MD / sticker4

Function sticker4

lib/sticker.js:93–108  ·  view source on GitHub ↗

* Image to Sticker * @param {Buffer} img Image/Video Buffer * @param {String} url Image/Video URL

(img, url)

Source from the content-addressed store, hash-verified

91 * @param {String} url Image/Video URL
92 */
93async function sticker4(img, url) {
94 if (url) {
95 let res = await fetch(url)
96 if (res.status !== 200) throw await res.text()
97 img = await res.buffer()
98 }
99 return await ffmpeg(
100 img,
101 [
102 '-vf',
103 'scale=512:512:flags=lanczos:force_original_aspect_ratio=decrease,format=rgba,pad=512:512:(ow-iw)/2:(oh-ih)/2:color=#00000000,setsar=1',
104 ],
105 'jpeg',
106 'webp'
107 )
108}
109
110async function sticker5(img, url, packname, author, categories = [''], extra = {}) {
111 const { Sticker } = await import('wa-sticker-formatter')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected