You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, metadataStr = "big Hero 6 2014 Wonder Project Amazon Channel Jun 30 2028 1:41:52") {
// Determine extracted lines based on input
let extractedLines = [];
const isDefault = metadataStr.trim() === "big Hero 6 2014 Wonder Project Amazon Channel Jun 30 2028 1:41:52";
if (isDefault) {
extractedLines = [
"> Movie Title : Big Hero 6",
"> Release Year: 2014",
"> Project : Wonder Project",
"> License : Amazon Channel",
"> Expiration : Jun 30 2028",
"> Duration : 1:41:52"
];
} else {
extractedLines = [
"> EXTRACTED RAW DATA:",
metadataStr
];
}
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
// Create a temporary canvas/context just to measure text accurately
ctx.font = '16px "Courier New", Courier, monospace';
let maxTextWidth = ctx.measureText("VIDEO METADATA EXTRACTOR").width;
extractedLines.forEach(line => {
const w = ctx.measureText(line).width;
if (w > maxTextWidth) maxTextWidth = w;
});
const padding = 20;
const minCanvasWidth = maxTextWidth + (padding * 4) + 150; // extra space for timestamp right-align
// Set actual canvas dimensions
canvas.width = Math.max(originalImg.width, minCanvasWidth);
const panelHeight = 90 + (extractedLines.length * 20);
canvas.height = originalImg.height + panelHeight;
// 1. Draw overall background
ctx.fillStyle = '#0a0a0a';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// 2. Draw original image (centered if canvas is wider)
const imgX = (canvas.width - originalImg.width) / 2;
ctx.drawImage(originalImg, imgX, 0);
// 3. Add visual HUD/scanning elements over the image
const p = 15;
if (originalImg.width > 2 * p && originalImg.height > 2 * p) {
// Scanning lines
ctx.fillStyle = 'rgba(0, 255, 204, 0.05)';
for (let y = 0; y < originalImg.height; y += 4) {
ctx.fillRect(imgX, y, originalImg.width, 1);
}
// Bounding Box
ctx.strokeStyle = 'rgba(0, 255, 204, 0.6)';
ctx.lineWidth = 1;
ctx.strokeRect(imgX + p, p, originalImg.width - 2 * p, originalImg.height - 2 * p);
// Corner Accents
ctx.lineWidth = 3;
const l = 25;
// TL
ctx.beginPath(); ctx.moveTo(imgX + p, p + l); ctx.lineTo(imgX + p, p); ctx.lineTo(imgX + p + l, p); ctx.stroke();
// TR
ctx.beginPath(); ctx.moveTo(imgX + originalImg.width - p - l, p); ctx.lineTo(imgX + originalImg.width - p, p); ctx.lineTo(imgX + originalImg.width - p, p + l); ctx.stroke();
// BL
ctx.beginPath(); ctx.moveTo(imgX + p, originalImg.height - p - l); ctx.lineTo(imgX + p, originalImg.height - p); ctx.lineTo(imgX + p + l, originalImg.height - p); ctx.stroke();
// BR
ctx.beginPath(); ctx.moveTo(imgX + originalImg.width - p, originalImg.height - p - l); ctx.lineTo(imgX + originalImg.width - p, originalImg.height - p); ctx.lineTo(imgX + originalImg.width - p - l, originalImg.height - p); ctx.stroke();
}
// 4. Draw Metadata Panel Background
const panelY = originalImg.height;
ctx.fillStyle = '#111111';
ctx.fillRect(0, panelY, canvas.width, panelHeight);
// Top border of panel
ctx.fillStyle = '#00ffcc';
ctx.fillRect(0, panelY, canvas.width, 3);
// 5. Draw Text Content
ctx.textBaseline = 'top';
ctx.textAlign = 'left';
// Panel Title
ctx.font = 'bold 18px "Courier New", Courier, monospace';
ctx.fillStyle = '#00ffcc';
ctx.fillText("VIDEO METADATA EXTRACTOR", padding, panelY + padding);
// Separator line
ctx.strokeStyle = '#333333';
ctx.lineWidth = 1;
ctx.beginPath();
ctx.moveTo(padding, panelY + 45);
ctx.lineTo(canvas.width - padding, panelY + 45);
ctx.stroke();
// Data Lines
ctx.font = '15px "Courier New", Courier, monospace';
ctx.fillStyle = '#e0e0e0';
extractedLines.forEach((line, index) => {
const y = panelY + 60 + (index * 22);
ctx.fillText(line, padding, y);
});
// 6. Draw System Mock Info on the right side
const hash = "HASH: " + Math.random().toString(16).substring(2, 10).toUpperCase();
const systemDate = isDefault ? "2028-06-30T00:00:00Z" : new Date().toISOString().split('T')[0];
ctx.textAlign = 'right';
ctx.font = '12px "Courier New", Courier, monospace';
ctx.fillStyle = '#666666';
ctx.fillText(hash, canvas.width - padding, canvas.height - 25);
ctx.fillText("SYS_TIME: " + systemDate, canvas.width - padding, canvas.height - 45);
ctx.fillText("STATUS: MATCH FOUND", canvas.width - padding, canvas.height - 65);
return canvas;
}
Apply Changes