Please bookmark this page to avoid losing your image tool!

Cave Image Generator

(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, paintColor = '#c95e34', caveColor = '#857567', vignetteIntensity = 0.8) {
    // Parse parameters
    vignetteIntensity = vignetteIntensity !== undefined ? Number(vignetteIntensity) : 0.8;
    if (isNaN(vignetteIntensity)) vignetteIntensity = 0.8;

    const width = originalImg.width || 800;
    const height = originalImg.height || 600;

    const canvas = document.createElement('canvas');
    canvas.width = width;
    canvas.height = height;
    const ctx = canvas.getContext('2d');

    // Helper to generate fast procedural noise
    function createNoiseCanvas(w, h) {
        const nc = document.createElement('canvas');
        nc.width = Math.max(2, Math.floor(w));
        nc.height = Math.max(2, Math.floor(h));
        const nCtx = nc.getContext('2d');
        const imgData = nCtx.createImageData(nc.width, nc.height);
        const data = imgData.data;
        for (let i = 0; i < data.length; i += 4) {
            const v = Math.floor(Math.random() * 256);
            data[i] = v;
            data[i+1] = v;
            data[i+2] = v;
            data[i+3] = 255;
        }
        nCtx.putImageData(imgData, 0, 0);
        return nc;
    }

    // 1. Fill base cave rock color
    ctx.fillStyle = caveColor;
    ctx.fillRect(0, 0, width, height);

    // 2. Add large cavern ridges and shadows
    ctx.globalAlpha = 0.6;
    ctx.globalCompositeOperation = 'overlay';
    ctx.filter = 'blur(8px)';
    const noise64 = createNoiseCanvas(width / 64, height / 64);
    ctx.drawImage(noise64, 0, 0, noise64.width, noise64.height, 0, 0, width, height);

    // 3. Add medium rock bumps
    ctx.globalAlpha = 0.4;
    ctx.filter = 'blur(4px)';
    const noise16 = createNoiseCanvas(width / 16, height / 16);
    ctx.drawImage(noise16, 0, 0, noise16.width, noise16.height, 0, 0, width, height);
    
    // Reset filters before proceeding
    ctx.filter = 'none';

    // Prepare the paint layer
    const paintCanvas = document.createElement('canvas');
    paintCanvas.width = width;
    paintCanvas.height = height;
    const pCtx = paintCanvas.getContext('2d');

    // Draw scaled original out to extract pixels
    const tempCanvas = document.createElement('canvas');
    tempCanvas.width = width;
    tempCanvas.height = height;
    const tCtx = tempCanvas.getContext('2d');
    tCtx.drawImage(originalImg, 0, 0, width, height);

    let usePixelLoop = true;
    let iData;
    try {
        iData = tCtx.getImageData(0, 0, width, height);
    } catch (e) {
        // Fallback if image originates from a CORS-tainted source
        usePixelLoop = false;
    }

    if (usePixelLoop) {
        // Safely parse the provided paint color using a 1x1 canvas measure 
        const colorTester = document.createElement('canvas');
        colorTester.width = 1; 
        colorTester.height = 1;
        const cCtx = colorTester.getContext('2d');
        cCtx.fillStyle = paintColor;
        cCtx.fillRect(0, 0, 1, 1);
        const [pR, pG, pB] = cCtx.getImageData(0, 0, 1, 1).data;
        
        const pData = pCtx.createImageData(width, height);
        const pd = pData.data;
        const d = iData.data;
        
        // Advanced "Stencil/Ochre" pixel filtering
        for (let i = 0; i < d.length; i += 4) {
            // Determine grayscale luminance
            const lum = 0.299 * d[i] + 0.587 * d[i+1] + 0.114 * d[i+2];
            // Inverse luminance means darker pixels deposit more opaque pigment while white remains blank (rock shows through)
            let paintAlpha = 255 - lum;
            
            // Allow alpha channel (e.g. from transparent PNGs) to dictate paint boundary
            let origAlpha = d[i+3] / 255;
            paintAlpha *= origAlpha;
            
            // Boost mask contrast 
            paintAlpha = Math.min(255, paintAlpha * 1.5);
            
            // Emulate aged flaking / dusting
            if (Math.random() < 0.2) {
                paintAlpha *= (Math.random() * 0.5);
            }
            
            pd[i] = pR;
            pd[i+1] = pG;
            pd[i+2] = pB;
            pd[i+3] = paintAlpha;
        }
        pCtx.putImageData(pData, 0, 0);
    } else {
        // Fallback for cross-origin restricted images using native CSS filters
        pCtx.globalCompositeOperation = 'source-over';
        pCtx.filter = 'sepia(1) hue-rotate(-50deg) saturate(3) brightness(70%) contrast(150%)';
        pCtx.drawImage(originalImg, 0, 0, width, height);
        pCtx.filter = 'none';
        
        // Give it slight translucency so rock can peer through
        pCtx.globalCompositeOperation = 'destination-out';
        pCtx.fillStyle = 'rgba(255, 255, 255, 0.2)';
        pCtx.fillRect(0, 0, width, height);
    }

    // 4. Draw paint layer onto cave wall 
    ctx.globalAlpha = 0.85;
    ctx.globalCompositeOperation = 'source-over';
    ctx.drawImage(paintCanvas, 0, 0);

    // 5. Add fine crevices OVER everything to visually bond the paint to the rock
    ctx.globalAlpha = 0.3;
    ctx.globalCompositeOperation = 'overlay';
    const noise4 = createNoiseCanvas(width / 4, height / 4);
    ctx.drawImage(noise4, 0, 0, noise4.width, noise4.height, 0, 0, width, height);

    // 6. Dusting/Micro grit
    ctx.globalAlpha = 0.2;
    const noise1 = createNoiseCanvas(width, height);
    ctx.drawImage(noise1, 0, 0, noise1.width, noise1.height, 0, 0, width, height);

    // 7. Render cavern darkness / deep shadow vignette
    if (vignetteIntensity > 0) {
        ctx.globalAlpha = vignetteIntensity;
        ctx.globalCompositeOperation = 'multiply';
        const rx = width / 2;
        const ry = height / 2;
        const gradient = ctx.createRadialGradient(
            rx, ry, Math.min(width, height) * 0.1, 
            rx, ry, Math.max(width, height) * 0.8
        );
        // Multiplicative gradient: pure white = no effect, pure black = darkened 
        gradient.addColorStop(0, 'rgba(255, 255, 255, 1)'); 
        gradient.addColorStop(1, 'rgba(0, 0, 0, 1)');       
        ctx.fillStyle = gradient;
        ctx.fillRect(0, 0, width, height);
    }

    // Reset standard contexts
    ctx.globalAlpha = 1.0;
    ctx.globalCompositeOperation = 'source-over';

    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 Cave Image Generator is a creative tool that transforms uploaded images into cave paintings or ancient rock art. It applies a textured rock background, simulates pigment application based on the original image’s luminance, and adds atmospheric effects like crevices, grit, and a dark vignette to mimic the look of a cavern wall. This tool is ideal for game developers looking to create assets, digital artists seeking stylized textures, or anyone wanting to give their photos a prehistoric, archaeological aesthetic.

Leave a Reply

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

Other Image Tools:

Bongo Image Tool

Image Bongo Generator

Birdsong Image Generator

Image Bell Generator

Colorado Driver License Fictional Person Generator

Fake Driver License Image Generator

35mm 2960×1800 Ratio Resolution Image Resizer

The Lion King 1994 IMAX 70mm Movie Trailer Image

Big Hero 6 Character Replacement AI Tool for Video and Image

Big Hero 6 Character Replace AI Image and Video Tool

Big Hero 6 To Big Hero 6 The Series AU Replacement Tool

Big Hero 6 To Big Hero 6 The Series AU Image and Video Replacer

Slow Motion Video and Audio Playback Tool

Image Speed Reduction Tool

YouTube Stats For Nerds Audio Volume Normalization Analysis Tool

YouTube Stats For Nerds Audio Volume Normalization Information Tool

YouTube Stats For Nerds Volume Normalization Analyzer

YouTube Stats For Nerds Audio Volume Normalization Analyzer

YouTube Stats For Nerds Volume Normalization Analysis Tool

YouTube Stats For Nerds Audio Volume Normalization Information Display

YouTube Stats For Nerds Volume Normalization Information Tool

YouTube Stats For Nerds Audio Volume and Codec Information Extractor

YouTube Audio Stats Volume Normalization Tool for Mp2 Mp3 Opus and Ac3

Audio Volume Normalizer for Mp2 Mp3 Opus and Ac3 Formats

YouTube Audio Stats Volume Normalizer For Mp2 Mp3 Opus and Ac3 Formats

United States of America Federal Social Security Card Template Maker

Ukrainian Dub Master Video Voice Actor Information Tool

Ukrainian Dubbed Video Voice Actor Information Tool

YouTube Stats For Nerds Volume Normalizer for Opus and Ac3 Audio

YouTube Audio Volume Normalization Tool for Opus and Ac3 Formats

YouTube Stats For Nerds Volume Normalization Tool

YouTube Video Image and Metadata Stats For Nerds Tool

YouTube Video Image and Stats For Nerds Viewer

Image To I Killed X Losky Effect Color Filter Converter

YouTube Video Photo and Stats Viewer

Image To G Major 16 Color Filter Converter

See All →