You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, scannerColor = "#0DFFFF", scanDurationMs = "3000") {
// Main container
const container = document.createElement('div');
container.style.fontFamily = "'Courier New', Courier, monospace";
container.style.maxWidth = '800px';
container.style.width = '100%';
container.style.margin = '0 auto';
container.style.background = '#0a0a0a';
container.style.color = '#fff';
container.style.border = '1px solid #333';
container.style.borderRadius = '8px';
container.style.overflow = 'hidden';
container.style.boxShadow = '0 10px 30px rgba(0,0,0,0.8)';
container.style.position = 'relative';
// Top Header Bar
const header = document.createElement('div');
header.style.background = '#1a1a1a';
header.style.padding = '12px 20px';
header.style.borderBottom = '1px solid #333';
header.style.display = 'flex';
header.style.justifyContent = 'space-between';
header.style.alignItems = 'center';
header.innerHTML = `
<span style="font-weight:bold; font-size: 16px; letter-spacing:2px; color: #eee;">
CINEMATIC IDENTIFIER HUD
</span>
<span style="font-size:12px; font-weight:bold; color:${scannerColor}; text-shadow: 0 0 5px ${scannerColor};">
SYSTEM.READY
</span>
`;
container.appendChild(header);
// Image Wrapper
const imgWrapper = document.createElement('div');
imgWrapper.style.position = 'relative';
imgWrapper.style.width = '100%';
imgWrapper.style.backgroundColor = '#000';
imgWrapper.style.display = 'flex';
imgWrapper.style.justifyContent = 'center';
imgWrapper.style.alignItems = 'center';
container.appendChild(imgWrapper);
// Canvas to draw the image safely while capping max size
const canvas = document.createElement('canvas');
const maxW = 800;
let scale = 1;
if (originalImg.width > maxW) {
scale = maxW / originalImg.width;
}
canvas.width = originalImg.width * scale;
canvas.height = originalImg.height * scale;
canvas.style.width = '100%';
canvas.style.height = 'auto';
canvas.style.display = 'block';
const ctx = canvas.getContext('2d');
ctx.drawImage(originalImg, 0, 0, canvas.width, canvas.height);
imgWrapper.appendChild(canvas);
// Overlay for HUD graphics
const overlay = document.createElement('div');
overlay.style.position = 'absolute';
overlay.style.top = '0';
overlay.style.left = '0';
overlay.style.width = '100%';
overlay.style.height = '100%';
overlay.style.pointerEvents = 'none'; // Ensure clicks pass through to underneath if necessary
imgWrapper.appendChild(overlay);
// Scanline element
const scanLine = document.createElement('div');
scanLine.style.position = 'absolute';
scanLine.style.top = '0';
scanLine.style.left = '0';
scanLine.style.width = '100%';
scanLine.style.height = '3px';
scanLine.style.backgroundColor = scannerColor;
scanLine.style.boxShadow = `0 0 10px ${scannerColor}, 0 0 25px ${scannerColor}, 0 0 50px ${scannerColor}`;
scanLine.style.display = 'none';
scanLine.style.zIndex = '10';
overlay.appendChild(scanLine);
// Corner HUD brackets
const bracketSize = '30px';
const bracketBorder = '3px solid rgba(255,255,255,0.7)';
const tl = document.createElement('div'); tl.style.position = 'absolute'; tl.style.top = '15px'; tl.style.left = '15px'; tl.style.width = bracketSize; tl.style.height = bracketSize; tl.style.borderTop = bracketBorder; tl.style.borderLeft = bracketBorder; overlay.appendChild(tl);
const tr = document.createElement('div'); tr.style.position = 'absolute'; tr.style.top = '15px'; tr.style.right = '15px'; tr.style.width = bracketSize; tr.style.height = bracketSize; tr.style.borderTop = bracketBorder; tr.style.borderRight = bracketBorder; overlay.appendChild(tr);
const bl = document.createElement('div'); bl.style.position = 'absolute'; bl.style.bottom = '15px'; bl.style.left = '15px'; bl.style.width = bracketSize; bl.style.height = bracketSize; bl.style.borderBottom = bracketBorder; bl.style.borderLeft = bracketBorder; overlay.appendChild(bl);
const br = document.createElement('div'); br.style.position = 'absolute'; br.style.bottom = '15px'; br.style.right = '15px'; br.style.width = bracketSize; br.style.height = bracketSize; br.style.borderBottom = bracketBorder; br.style.borderRight = bracketBorder; overlay.appendChild(br);
// Results Box Popup
const resultBox = document.createElement('div');
resultBox.style.position = 'absolute';
resultBox.style.top = '50%';
resultBox.style.left = '50%';
resultBox.style.transform = 'translate(-50%, -50%)';
resultBox.style.backgroundColor = 'rgba(0, 0, 0, 0.9)';
resultBox.style.border = `1px solid ${scannerColor}`;
resultBox.style.padding = '25px';
resultBox.style.borderRadius = '5px';
resultBox.style.boxShadow = `0 0 30px rgba(0,0,0,0.9), inset 0 0 15px rgba(0,0,0,0.7)`;
resultBox.style.display = 'none';
resultBox.style.minWidth = '280px';
resultBox.style.pointerEvents = 'auto'; // allow text selection within box
resultBox.style.zIndex = '20';
overlay.appendChild(resultBox);
// Progress Status Text Container
const progressText = document.createElement('div');
progressText.style.position = 'absolute';
progressText.style.bottom = '30px';
progressText.style.left = '35px';
progressText.style.color = scannerColor;
progressText.style.textShadow = `0 0 8px ${scannerColor}`;
progressText.style.fontSize = '14px';
progressText.style.fontWeight = 'bold';
progressText.style.display = 'none';
progressText.style.backgroundColor = 'rgba(0,0,0,0.6)';
progressText.style.padding = '5px 10px';
progressText.style.borderRadius = '3px';
overlay.appendChild(progressText);
// Bottom Controls section
const controls = document.createElement('div');
controls.style.padding = '20px';
controls.style.display = 'flex';
controls.style.justifyContent = 'center';
controls.style.alignItems = 'center';
controls.style.background = '#111';
container.appendChild(controls);
// Action Button
const btn = document.createElement('button');
btn.innerText = 'INITIALIZE SCAN';
btn.style.fontFamily = 'inherit';
btn.style.padding = '12px 25px';
btn.style.fontSize = '16px';
btn.style.fontWeight = 'bold';
btn.style.color = '#000';
btn.style.backgroundColor = scannerColor;
btn.style.border = 'none';
btn.style.borderRadius = '4px';
btn.style.cursor = 'pointer';
btn.style.boxShadow = `0 0 15px ${scannerColor}88`;
btn.style.transition = 'all 0.2s ease-in-out';
btn.onmouseover = () => btn.style.boxShadow = `0 0 25px ${scannerColor}`;
btn.onmouseout = () => btn.style.boxShadow = `0 0 15px ${scannerColor}88`;
controls.appendChild(btn);
// Analyze the image to procedurally pick metadata (simulating identification)
let rAvg = 125, gAvg = 125, bAvg = 125;
try {
const imgData = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
let rSum = 0, gSum = 0, bSum = 0, count = 0;
const step = 4 * 19; // Skip pixels for speed
for(let i = 0; i < imgData.length; i += step) {
rSum += imgData[i];
gSum += imgData[i+1];
bSum += imgData[i+2];
count++;
}
rAvg = Math.floor(rSum/count);
gAvg = Math.floor(gSum/count);
bAvg = Math.floor(bSum/count);
} catch(e) {
// Fallback for cross-origin taint errors
rAvg = Math.floor(Math.random() * 255);
gAvg = Math.floor(Math.random() * 255);
bAvg = Math.floor(Math.random() * 255);
}
const luma = 0.2126 * rAvg + 0.7152 * gAvg + 0.0722 * bAvg;
const pre = ["The", "A", "Dark", "Silent", "Lost", "Final", "Hidden", "Secret", "Neon", "Crimson", "Midnight", "Fallen", "Eternal"];
const mid = ["Knight", "Star", "Shadow", "Dream", "Sun", "Moon", "Time", "Space", "City", "Ocean", "Forest", "Matrix", "Kingdom"];
const post = ["Returns", "Awakens", "Rises", "Breaks", "Falls", "Chronicles", "Protocol", "Paradox", "Legacy", "Reborn", "Identity"];
const titleText = `${pre[rAvg % pre.length]} ${mid[gAvg % mid.length]} ${post[bAvg % post.length]}`;
const yearNum = ((rAvg + gAvg + bAvg) % 50) + 1974;
let genreStr = "Drama";
if (rAvg > gAvg && rAvg > bAvg) genreStr = luma < 100 ? "Horror / Thriller" : "Action / Adventure";
else if (gAvg > rAvg && gAvg > bAvg) genreStr = "Sci-Fi / Fantasy";
else if (bAvg > rAvg && bAvg > gAvg) genreStr = luma < 100 ? "Noir / Mystery" : "Animation / Family";
else genreStr = "Documentary";
const confidenceNum = 85 + ((rAvg * gAvg) % 14) + (Math.random() * 0.9);
// Interactive Scan Logic
btn.onclick = () => {
btn.disabled = true;
btn.style.opacity = '0.4';
btn.innerText = 'SCANNING IN PROGRESS...';
btn.style.cursor = 'not-allowed';
resultBox.style.display = 'none';
scanLine.style.display = 'block';
progressText.style.display = 'block';
let startTime = null;
const duration = parseInt(scanDurationMs, 10) || 3000;
function animate(time) {
if (!startTime) startTime = time;
const elapsed = time - startTime;
const progress = elapsed / duration;
if (progress < 1) {
// Creates a bouncing scanline effect over the image
const wave = (Math.sin(progress * Math.PI * 6) + 1) / 2; // oscillates 0 to 1
scanLine.style.top = `${wave * 98}%`;
// Update text to simulate real database querying
if (progress < 0.2) progressText.innerText = '> Extracting visual color matrices...';
else if (progress < 0.4) progressText.innerText = '> Matching algorithmic histograms...';
else if (progress < 0.6) progressText.innerText = '> Querying cinematic AI database...';
else if (progress < 0.8) progressText.innerText = '> Cross-referencing facial/scene metadata...';
else progressText.innerText = '> Finalizing match probabilities...';
requestAnimationFrame(animate);
} else {
// Animation finished
scanLine.style.display = 'none';
progressText.style.display = 'none';
btn.disabled = false;
btn.style.opacity = '1';
btn.innerText = 'RE-INITIALIZE SCAN';
btn.style.cursor = 'pointer';
// Display Results
resultBox.style.display = 'block';
resultBox.innerHTML = `
<h3 style="margin: 0 0 15px 0; border-bottom: 2px solid ${scannerColor}; padding-bottom: 8px; color: ${scannerColor}; text-align: center; font-size: 18px; letter-spacing: 1px;">
MATCH CONFIRMED
</h3>
<table style="width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.8;">
<tr><td style="color:#aaa; padding-right:15px;">TITLE:</td> <td style="font-weight:bold; color:#fff;">${titleText}</td></tr>
<tr><td style="color:#aaa;">YEAR:</td> <td style="font-weight:bold; color:#fff;">${yearNum}</td></tr>
<tr><td style="color:#aaa;">GENRE:</td> <td style="font-weight:bold; color:#fff;">${genreStr}</td></tr>
<tr><td style="color:#aaa;">CONFIDENCE:</td> <td style="font-weight:bold; color:${scannerColor};">${confidenceNum.toFixed(1)}%</td></tr>
</table>
`;
}
}
requestAnimationFrame(animate);
};
return container;
}
Apply Changes