Skip to content

Instantly share code, notes, and snippets.

@AlenVelocity
Last active December 24, 2020 14:31
Show Gist options
  • Save AlenVelocity/b59f2700590e0c553e9a2778b6230dd7 to your computer and use it in GitHub Desktop.
Save AlenVelocity/b59f2700590e0c553e9a2778b6230dd7 to your computer and use it in GitHub Desktop.
import {
writeFile
} from "fs";
const stickerPackID = "com.snowcorp.stickerly.android.stickercontentprovider b5e7275f-f1de-4137-961f-57becfad34f2"; //not sure what this does
const googleLink = "https://play.google.com/store/apps/details?id=com.marsconstd.stickermakerforwhatsapp";
const appleLink = "https://itunes.apple.com/app/sticker-maker-studio/id1443326857";
export function createExif(packname: string, author: string, id: string) {
const json = {
"sticker-pack-id": stickerPackID,
"sticker-pack-name": packname,
"sticker-pack-publisher": author,
"android-app-store-link": googleLink,
"ios-app-store-link": appleLink
};
let length: any = JSON.stringify(json).length;
const f = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00]);
const code = [0x00,
0x00,
0x16,
0x00,
0x00,
0x00];
if (length > 256) {
length = length - 256;
code.unshift(0x01);
} else {
code.unshift(0x00);
}
const fff = Buffer.from(code);
const ffff = Buffer.from(JSON.stringify(json));
if (length < 16) {
length = length.toString(16);
length = "0" + length;
} else {
length = length.toString(16);
}
const ff = Buffer.from(length, "hex");
const buffer = Buffer.concat([f, ff, fff, ffff]);
writeFile(`${id}.exif`, buffer, function (err: Error) {
if (err)
return console.error(err);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment