You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(
originalImg,
movieTitle = "UNTITLED PROJECT",
director = "UNKNOWN",
scene = "1A",
take = "3",
archiveDate = "24-OCT-1988"
) {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const width = originalImg.width;
const imgHeight = originalImg.height;
// Determine UI height dynamically based on image size to maintain proportions
const uiHeight = Math.floor(Math.max(width * 0.08, 45));
// Expand canvas height to accommodate the studio UI overlays (letterboxing)
canvas.width = width;
canvas.height = imgHeight + (uiHeight * 2);
// 1. Fill entire background black
ctx.fillStyle = "#000000";
ctx.fillRect(0, 0, canvas.width, canvas.height);
const imgY = uiHeight;
// 2. Draw original image in the central area
ctx.drawImage(originalImg, 0, imgY, width, imgHeight);
// 3. Apply a subtle cinematic color tint over the image
ctx.fillStyle = "rgba(0, 15, 30, 0.15)";
ctx.fillRect(0, imgY, width, imgHeight);
// 4. Apply a vignette effect to the image area for a dramatic look
const cx = width / 2;
const cy = imgY + (imgHeight / 2);
const vignette = ctx.createRadialGradient(cx, cy, imgHeight * 0.4, cx, cy, imgHeight * 0.9);
vignette.addColorStop(0, "rgba(0,0,0,0)");
vignette.addColorStop(1, "rgba(0,0,0,0.6)");
ctx.fillStyle = vignette;
ctx.fillRect(0, imgY, width, imgHeight);
// 5. Setup line styles for borders and safe zones
const lineWidth = Math.max(1, Math.floor(width * 0.003));
ctx.strokeStyle = "#FFFFFF";
ctx.lineWidth = lineWidth;
// Draw main frame borders separating the DB letterboxes from the image
ctx.beginPath();
ctx.moveTo(0, imgY);
ctx.lineTo(width, imgY);
ctx.moveTo(0, canvas.height - uiHeight);
ctx.lineTo(width, canvas.height - uiHeight);
ctx.stroke();
// 6. Draw Action Safe Zone & Crosshairs on the image (Technical Studio Overlay)
ctx.strokeStyle = "rgba(255, 255, 255, 0.4)";
const safeMarginX = width * 0.05;
const safeMarginY = imgHeight * 0.05;
const dashLength = width * 0.01;
ctx.setLineDash([dashLength, dashLength]);
ctx.strokeRect(safeMarginX, imgY + safeMarginY, width - 2 * safeMarginX, imgHeight - 2 * safeMarginY);
ctx.setLineDash([]); // Reset dashed lines
// Center Crosshairs
const crossSize = Math.max(15, width * 0.02);
ctx.beginPath();
ctx.moveTo(cx - crossSize, cy);
ctx.lineTo(cx + crossSize, cy);
ctx.moveTo(cx, cy - crossSize);
ctx.lineTo(cx, cy + crossSize);
ctx.stroke();
// 7. Typography Settings
const baseFontSize = Math.floor(uiHeight * 0.35);
const labelFontSize = Math.floor(uiHeight * 0.22);
const padding = Math.max(5, Math.floor(width * 0.01));
// 8. Top UI (Archive Info / Timecode)
ctx.textBaseline = "middle";
ctx.font = `bold ${baseFontSize}px "Courier New", Courier, monospace`;
ctx.fillStyle = "#FFFFFF";
// Top Left: Database ID
ctx.textAlign = "left";
const dbHash = Math.floor(Math.random() * 10E7).toString(16).toUpperCase();
ctx.fillText(`STUDIO ASSET INVENTORY // REF:0x${dbHash}`, padding, uiHeight / 2);
// Top Center: Timecode
const genTimecode = () => {
const pad = (n) => String(n).padStart(2, '0');
const h = pad(Math.floor(Math.random() * 24));
const m = pad(Math.floor(Math.random() * 60));
const s = pad(Math.floor(Math.random() * 60));
const f = pad(Math.floor(Math.random() * 24));
return `${h}:${m}:${s}:${f}`;
};
ctx.textAlign = "center";
ctx.fillText(`TC: ${genTimecode()}`, width / 2, uiHeight / 2);
// Top Right: REC indicator
ctx.textAlign = "right";
const recText = "REC";
ctx.fillText(recText, width - padding, uiHeight / 2);
// Red dot for REC
const recTextWidth = ctx.measureText(recText).width;
ctx.fillStyle = "#FF3333";
ctx.beginPath();
ctx.arc(width - padding - recTextWidth - (baseFontSize * 0.8), uiHeight / 2, baseFontSize * 0.4, 0, Math.PI * 2);
ctx.fill();
// 9. Bottom UI (Database Fields Table)
const bottomY = canvas.height - uiHeight;
const segments = [
{ label: "TITLE", val: movieTitle, pct: 0.30 },
{ label: "DIRECTOR", val: director, pct: 0.25 },
{ label: "SCENE", val: scene, pct: 0.15 },
{ label: "TAKE", val: take, pct: 0.15 },
{ label: "ARCHIVE DATE", val: archiveDate, pct: 0.15 }
];
let currentX = 0;
ctx.strokeStyle = "#FFFFFF";
segments.forEach((seg, index) => {
const segWidth = width * seg.pct;
// Draw vertical separator line (skip the last right edge)
if (index < segments.length - 1) {
ctx.beginPath();
ctx.moveTo(currentX + segWidth, bottomY);
ctx.lineTo(currentX + segWidth, canvas.height);
ctx.stroke();
}
// Draw Label
ctx.fillStyle = "#888888";
ctx.textAlign = "left";
ctx.textBaseline = "top";
ctx.font = `${labelFontSize}px "Courier New", Courier, monospace`;
ctx.fillText(seg.label, currentX + padding, bottomY + padding);
// Draw Value
ctx.fillStyle = "#FFFFFF";
ctx.textBaseline = "bottom";
ctx.font = `bold ${baseFontSize}px "Courier New", Courier, monospace`;
// Using max-width argument of fillText to ensure text fits inside the segments
ctx.fillText(seg.val, currentX + padding, canvas.height - padding, segWidth - (padding * 2));
currentX += segWidth;
});
return canvas;
}
Apply Changes