You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, colorTint = "#ff0000", scanlineIntensity = 50, addHUD = 1) {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const w = originalImg.width;
const h = originalImg.height;
canvas.width = w;
canvas.height = h;
// Draw the original image
ctx.drawImage(originalImg, 0, 0);
// Get the RGB values of the requested tint color
const tempCanvas = document.createElement('canvas');
tempCanvas.width = 1;
tempCanvas.height = 1;
const tCtx = tempCanvas.getContext('2d');
tCtx.fillStyle = colorTint;
tCtx.fillRect(0, 0, 1, 1);
const tintData = tCtx.getImageData(0, 0, 1, 1).data;
const tr = tintData[0];
const tg = tintData[1];
const tb = tintData[2];
// Process pixels to create a luminescent robotic vision (grayscale mapping to tint color)
const imgData = ctx.getImageData(0, 0, w, h);
const data = imgData.data;
for (let i = 0; i < data.length; i += 4) {
const r = data[i];
const g = data[i + 1];
const b = data[i + 2];
// Calculate original luminance
const luma = 0.299 * r + 0.587 * g + 0.114 * b;
// Map to tint color and boost brightness slightly for that glowing display effect
data[i] = Math.min(255, (luma * tr * 1.5) / 255);
data[i + 1] = Math.min(255, (luma * tg * 1.5) / 255);
data[i + 2] = Math.min(255, (luma * tb * 1.5) / 255);
}
ctx.putImageData(imgData, 0, 0);
// Apply CRT / Robotic scanlines
const scanHeight = Math.max(1, Math.floor(h / 400));
ctx.fillStyle = `rgba(0, 0, 0, ${scanlineIntensity / 100})`;
for (let y = 0; y < h; y += scanHeight * 2) {
ctx.fillRect(0, y, w, scanHeight);
}
// Apply vignette to simulate screen edges / robotic optical lens
const grad = ctx.createRadialGradient(w / 2, h / 2, Math.min(w, h) * 0.3, w / 2, h / 2, Math.max(w, h) * 0.8);
grad.addColorStop(0, 'rgba(0,0,0,0)');
grad.addColorStop(1, 'rgba(0,0,0,0.85)');
ctx.fillStyle = grad;
ctx.fillRect(0, 0, w, h);
// Apply "Robot 30000" Heads Up Display (HUD) overlay
if (addHUD === 1) {
ctx.strokeStyle = colorTint;
ctx.fillStyle = colorTint;
ctx.lineWidth = Math.max(1, w / 400);
const cx = w / 2;
const cy = h / 2;
const chSize = Math.max(30, w / 20);
// Center crosshair intercepts
ctx.beginPath();
ctx.moveTo(cx - chSize, cy); ctx.lineTo(cx - chSize / 3, cy);
ctx.moveTo(cx + chSize, cy); ctx.lineTo(cx + chSize / 3, cy);
ctx.moveTo(cx, cy - chSize); ctx.lineTo(cx, cy - chSize / 3);
ctx.moveTo(cx, cy + chSize); ctx.lineTo(cx, cy + chSize / 3);
ctx.stroke();
// Center dot
ctx.beginPath();
ctx.arc(cx, cy, chSize / 15, 0, Math.PI * 2);
ctx.fill();
// Target box corners
const boxS = chSize * 2.5;
const edge = chSize * 0.8;
ctx.beginPath();
// Top Left
ctx.moveTo(cx - boxS + edge, cy - boxS); ctx.lineTo(cx - boxS, cy - boxS); ctx.lineTo(cx - boxS, cy - boxS + edge);
// Top Right
ctx.moveTo(cx + boxS - edge, cy - boxS); ctx.lineTo(cx + boxS, cy - boxS); ctx.lineTo(cx + boxS, cy - boxS + edge);
// Bottom Left
ctx.moveTo(cx - boxS + edge, cy + boxS); ctx.lineTo(cx - boxS, cy + boxS); ctx.lineTo(cx - boxS, cy + boxS - edge);
// Bottom Right
ctx.moveTo(cx + boxS - edge, cy + boxS); ctx.lineTo(cx + boxS, cy + boxS); ctx.lineTo(cx + boxS, cy + boxS - edge);
ctx.stroke();
// Technical Readout Fonts
const fontSize = Math.max(12, w / 40);
ctx.font = `bold ${fontSize}px "Courier New", Courier, monospace`;
ctx.textBaseline = 'top';
// Left side text data
const padX = w * 0.05;
const padY = h * 0.05;
const lineH = Math.max(14, fontSize * 1.5);
ctx.textAlign = 'left';
ctx.fillText(`ROBOT_30000_OS V2.4`, padX, padY);
ctx.fillText(`ACQUIRING TARGET...`, padX, padY + lineH);
ctx.fillText(`DIST: ${(Math.random() * 100 + 10).toFixed(2)}M`, padX, padY + lineH * 2);
// Right side diagnostic data
const rStr = () => Math.random().toString(16).substring(2, 6).toUpperCase();
ctx.textAlign = 'right';
ctx.fillText(`SYS.${rStr()}`, w - padX, padY);
ctx.fillText(`MEM.${rStr()}`, w - padX, padY + lineH);
// Diagnostic Data Bars (Simulating visual processing activity)
const barW = Math.max(3, w / 150);
const barMaxH = Math.max(20, h / 12);
for(let i = 0; i < 8; i++) {
const bH = (Math.random() * 0.8 + 0.2) * barMaxH; // Random heights
ctx.fillRect(w - padX - (i * (barW * 2)), padY + lineH * 3 + barMaxH - bH, barW, bH);
}
}
return canvas;
}
Apply Changes