You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, hudColor = "#00FF64", overlayAlpha = 0.6) {
const canvas = document.createElement('canvas');
canvas.width = originalImg.width;
canvas.height = originalImg.height;
const ctx = canvas.getContext('2d');
const w = canvas.width;
const h = canvas.height;
const baseFontSize = Math.max(12, Math.min(w, h) * 0.03);
let logEntries = [];
const pushLog = (msg) => {
logEntries.push(msg);
ctx.clearRect(0, 0, w, h);
ctx.drawImage(originalImg, 0, 0);
ctx.fillStyle = `rgba(0, 10, 5, ${overlayAlpha})`;
ctx.fillRect(0, 0, w, h);
ctx.fillStyle = hudColor;
ctx.font = `bold ${baseFontSize}px "Courier New", Courier, monospace`;
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
let startY = h * 0.1;
logEntries.forEach(entry => {
ctx.fillText(entry, w * 0.05, startY);
startY += baseFontSize * 1.5;
});
};
pushLog("> SYSTEM INITIALIZATION...");
const loadScript = (src, globalVar) => {
return new Promise((resolve, reject) => {
if (window[globalVar]) {
resolve();
return;
}
const script = document.createElement('script');
script.src = src;
script.crossOrigin = "anonymous";
script.onload = resolve;
script.onerror = reject;
document.head.appendChild(script);
});
};
// Execute asynchronously to unblock the Canvas return immediately
(async () => {
let predictions = [{className: "UNIDENTIFIED ANOMALY", probability: 0.99}];
try {
pushLog("> LOADING AI TENSOR CORE [@tensorflow/tfjs]...");
await loadScript('https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.20.0/dist/tf.min.js', 'tf');
pushLog("> LOADING MOBILENET CLASSIFIER MODULE...");
await loadScript('https://cdn.jsdelivr.net/npm/@tensorflow-models/mobilenet@2.1.0/dist/mobilenet.min.js', 'mobilenet');
pushLog("> EXECUTING IDENTIFIER SEARCH...");
// Load and classify the original image
const model = await window.mobilenet.load({version: 2, alpha: 0.5});
predictions = await model.classify(originalImg);
pushLog("> ANALYSIS COMPLETE. GENERATING HUD...");
} catch (e) {
console.error("AI Load failed:", e);
pushLog("> ERROR: NETWORK DENIED OR SECURE DATA PROTOCOL. OFFLINE MODE.");
predictions = [{className: "SECURE_DATA_OFFLINE_MODE", probability: 0}];
}
// Slight aesthetic delay to make loading feel realistic
setTimeout(() => {
ctx.clearRect(0, 0, w, h);
ctx.drawImage(originalImg, 0, 0);
// Atmospheric overlay
ctx.fillStyle = `rgba(0, 15, 5, ${overlayAlpha})`;
ctx.fillRect(0, 0, w, h);
// Draw Scanner Grid
ctx.strokeStyle = hudColor;
ctx.globalAlpha = 0.15;
ctx.lineWidth = 1;
const gridSize = Math.max(w, h) / 15;
ctx.beginPath();
for (let x = 0; x <= w; x += gridSize) { ctx.moveTo(x, 0); ctx.lineTo(x, h); }
for (let y = 0; y <= h; y += gridSize) { ctx.moveTo(0, y); ctx.lineTo(w, y); }
ctx.stroke();
ctx.globalAlpha = 1.0;
// Draw Targeting Crosshairs
ctx.strokeStyle = hudColor;
ctx.lineWidth = Math.max(2, w * 0.005);
const cw = w / 2;
const ch = h / 2;
const size = Math.min(w, h) * 0.25;
const cornerSize = size * 0.2;
ctx.beginPath();
// Top-Left
ctx.moveTo(cw - size, ch - size + cornerSize);
ctx.lineTo(cw - size, ch - size);
ctx.lineTo(cw - size + cornerSize, ch - size);
// Top-Right
ctx.moveTo(cw + size - cornerSize, ch - size);
ctx.lineTo(cw + size, ch - size);
ctx.lineTo(cw + size, ch - size + cornerSize);
// Bottom-Left
ctx.moveTo(cw - size, ch + size - cornerSize);
ctx.lineTo(cw - size, ch + size);
ctx.lineTo(cw - size + cornerSize, ch + size);
// Bottom-Right
ctx.moveTo(cw + size - cornerSize, ch + size);
ctx.lineTo(cw + size, ch + size);
ctx.lineTo(cw + size, ch + size - cornerSize);
ctx.stroke();
// Inner Center Cross
ctx.beginPath();
ctx.moveTo(cw, ch - cornerSize * 0.5);
ctx.lineTo(cw, ch + cornerSize * 0.5);
ctx.moveTo(cw - cornerSize * 0.5, ch);
ctx.lineTo(cw + cornerSize * 0.5, ch);
ctx.stroke();
// Rendering HUD Text blocks
ctx.fillStyle = hudColor;
ctx.font = `bold ${baseFontSize}px "Courier New", Courier, monospace`;
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
const margin = w * 0.03;
let topY = margin;
ctx.fillText("ANALYZER // IDENTIFIER SEARCH", margin, topY);
topY += baseFontSize * 1.5;
ctx.fillText("TOPICS IDENTIFIED:", margin, topY);
topY += baseFontSize * 1.5;
predictions.forEach((p) => {
const text = `> ${p.className.toUpperCase()} [${(p.probability * 100).toFixed(1)}%]`;
ctx.fillText(text, margin, topY);
topY += baseFontSize * 1.2;
});
// Top Right HUD Block
ctx.textAlign = 'right';
let rightY = margin;
ctx.fillText("КИНОСТУДИИ: СОЗДАТЬ ПРОЕКТ", w - margin, rightY);
rightY += baseFontSize * 1.5;
ctx.fillText("FILM STUDIO PROJECT INIT", w - margin, rightY);
rightY += baseFontSize * 1.5;
ctx.fillText("STATUS: ACTIVE", w - margin, rightY);
rightY += baseFontSize * 1.5;
const dateStr = new Date().toISOString().replace("T", " ").substring(0, 19) + "Z";
ctx.fillText(dateStr, w - margin, rightY);
// Bottom Left Module Analysis Box
ctx.textAlign = 'left';
const rx = margin;
const ry = h - margin - baseFontSize * 4;
const rw = w * 0.3;
const rh = baseFontSize * 4;
ctx.strokeStyle = hudColor;
ctx.lineWidth = 1;
ctx.strokeRect(rx, ry, rw, rh);
ctx.fillStyle = hudColor;
ctx.fillRect(rx, ry - baseFontSize * 1.2, rw, baseFontSize * 1.2);
ctx.fillStyle = "#000000";
ctx.fillText("MODULE ANALYSIS", rx + 5, ry - baseFontSize * 1.2 + 2);
ctx.fillStyle = hudColor;
ctx.font = `${Math.max(10, baseFontSize * 0.8)}px "Courier New", Courier, monospace`;
ctx.fillText(`TARGET DIM: ${w}x${h}`, rx + 5, ry + 5);
ctx.fillText(`GEO-LOC: UNAVAILABLE`, rx + 5, ry + 5 + baseFontSize);
ctx.fillText(`ENCRYPTION: 256-BIT RSA`, rx + 5, ry + 5 + baseFontSize * 2);
// Bottom Right Encrypted Data Simulation
ctx.textAlign = 'right';
let hexY = h - margin - baseFontSize * 3;
for(let i = 0; i < 3; i++) {
let rHex = Math.floor(Math.random() * 16777215).toString(16).toUpperCase().padStart(6, '0');
ctx.fillText(`0x${rHex} M-BLOCK`, w - margin, hexY);
hexY += baseFontSize;
}
}, 500);
})();
return canvas;
}
Apply Changes