@nanggo/social-preview
Version:
Generate beautiful social media preview images from any URL
23 lines (22 loc) • 774 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTransparentCanvas = createTransparentCanvas;
const sharp_1 = __importDefault(require("sharp"));
const security_1 = require("../../constants/security");
/**
* Creates a transparent canvas for templates that provide their own background.
*/
function createTransparentCanvas(width, height) {
return (0, sharp_1.default)({
create: {
width,
height,
channels: 4,
background: { r: 0, g: 0, b: 0, alpha: 0 }, // Transparent
},
...security_1.SHARP_SECURITY_CONFIG,
});
}