Please bookmark this page to avoid losing your image tool!

Green Squad Image Tool

(Free & Supports Bulk Upload)

Drag & drop your images here or

The result will appear here...
You can edit the below JavaScript code to customize the image tool.
function processImage(originalImg, intensity = 100, style = "nightvision") {
    // Create an offscreen canvas
    const canvas = document.createElement('canvas');
    canvas.width = originalImg.width;
    canvas.height = originalImg.height;
    const ctx = canvas.getContext('2d');
    
    // Draw the original image onto the canvas
    ctx.drawImage(originalImg, 0, 0);

    // Fetch pixel data
    const imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    const data = imgData.data;

    // Constrain intensity between 0 and 100, then convert to a 0.0 - 1.0 factor
    const factor = Math.max(0, Math.min(100, Number(intensity) || 100)) / 100;
    
    // Constants for vignette calculation in 'nightvision' mode
    const cx = canvas.width / 2;
    const cy = canvas.height / 2;
    const maxDist = Math.sqrt(cx * cx + cy * cy);

    for (let i = 0; i < data.length; i += 4) {
        const r = data[i];
        const g = data[i + 1];
        const b = data[i + 2];

        // Calculate standard grayscale luminance
        const lum = 0.299 * r + 0.587 * g + 0.114 * b;

        let newR, newG, newB;

        if (style === "camo") {
            // "Camo" Mode: Posterize luminance into 4 classic military camouflage colors
            if (lum < 64) {
                newR = 30; newG = 40; newB = 20; // Black / Dark brown
            } else if (lum < 128) {
                newR = 75; newG = 83; newB = 32; // Dark olive green
            } else if (lum < 192) {
                newR = 120; newG = 134; newB = 59; // Light olive green
            } else {
                newR = 194; newG = 178; newB = 128; // Tan / Sand
            }
        } else {
            // "Night Vision" Mode (Default): High contrast green with scanline, noise, and vignette
            const pixelIndex = i / 4;
            const x = pixelIndex % canvas.width;
            const y = Math.floor(pixelIndex / canvas.width);
            
            // Map luminance mostly to the green channel
            newR = lum * 0.1;
            newG = lum * 1.6;
            newB = lum * 0.1;

            if (newG > 255) newG = 255;

            // Apply horizontal scanline effect (dim every other row slightly)
            if (y % 2 === 0) {
                newG *= 0.85;
            }

            // Apply vignette effect (darker towards the edges)
            const dx = x - cx;
            const dy = y - cy;
            const dist = Math.sqrt(dx * dx + dy * dy);
            const vignette = 1 - (dist / maxDist) * 0.45;

            newR = Math.min(255, newR * vignette);
            newG = Math.min(255, newG * vignette);
            newB = Math.min(255, newB * vignette);
            
            // Add slight random noise to simulate night vision goggles
            const noise = (Math.random() - 0.5) * 30; // Random shift
            newG = Math.max(0, Math.min(255, newG + noise));
        }

        // Apply intensity blending between original image and the green squad effect
        data[i]     = r + (newR - r) * factor;
        data[i + 1] = g + (newG - g) * factor;
        data[i + 2] = b + (newB - b) * factor;
    }

    // Write manipulated pixel data back to the canvas
    ctx.putImageData(imgData, 0, 0);

    return canvas;
}

Free Image Tool Creator

Can't find the image tool you're looking for?
Create one based on your own needs now!

Description

The Green Squad Image Tool is a specialized photo filter application that applies tactical visual styles to images. Users can transform their photos using two distinct modes: a ‘Night Vision’ effect, which features high-contrast green tones, scanlines, vignette shading, and simulated noise; or a ‘Camo’ mode, which posterizes images into a military-inspired palette of olive greens, tans, and dark browns. With adjustable intensity settings, this tool is ideal for creating stylized content for gaming, themed social media posts, or artistic digital projects.

Leave a Reply

Your email address will not be published. Required fields are marked *