Please bookmark this page to avoid losing your image tool!

Image Key And Magic Effect 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, magicHue = "280", magicIntensity = "30", keyScale = "0.7", magicDustCount = "150") {
    // Parameter parsing
    const hue = parseInt(magicHue) || 280;
    const blurIntensity = parseInt(magicIntensity) || 30;
    const scale = parseFloat(keyScale) || 0.7;
    const dustCount = parseInt(magicDustCount) || 150;

    // Base Canvas Setup
    const canvas = document.createElement('canvas');
    const width = originalImg.naturalWidth || originalImg.width;
    const height = originalImg.naturalHeight || originalImg.height;
    canvas.width = width;
    canvas.height = height;
    const ctx = canvas.getContext('2d');

    // 1. Draw original Image
    ctx.drawImage(originalImg, 0, 0);

    // 2. Apply "Magic" Color Shift (Overlay)
    ctx.globalCompositeOperation = 'overlay';
    const magicGrad = ctx.createLinearGradient(0, 0, width, height);
    magicGrad.addColorStop(0, `hsla(${hue}, 100%, 60%, 0.7)`);
    magicGrad.addColorStop(1, `hsla(${(hue + 60) % 360}, 100%, 40%, 0.7)`);
    ctx.fillStyle = magicGrad;
    ctx.fillRect(0, 0, width, height);

    // 3. Apply Mysterious Vignette (Multiply)
    ctx.globalCompositeOperation = 'multiply';
    const cx = width / 2;
    const cy = height / 2;
    const vignette = ctx.createRadialGradient(cx, cy, Math.min(width, height) / 3, cx, cy, Math.max(width, height) / 1.2);
    vignette.addColorStop(0, 'rgba(0, 0, 0, 0)');
    vignette.addColorStop(1, 'rgba(10, 0, 25, 0.85)');
    ctx.fillStyle = vignette;
    ctx.fillRect(0, 0, width, height);

    // 4. Central Magic Aura (Screen)
    ctx.globalCompositeOperation = 'screen';
    const auraSize = Math.min(width, height) * scale;
    const aura = ctx.createRadialGradient(cx, cy, 0, cx, cy, auraSize);
    aura.addColorStop(0, `hsla(${hue}, 100%, 60%, 0.8)`);
    aura.addColorStop(0.3, `hsla(${hue}, 100%, 50%, 0.3)`);
    aura.addColorStop(1, 'rgba(0, 0, 0, 0)');
    ctx.fillStyle = aura;
    ctx.fillRect(0, 0, width, height);

    // Reset composite operation to normal
    ctx.globalCompositeOperation = 'source-over';

    // 5. Draw Magic Sparkles
    for (let i = 0; i < dustCount; i++) {
        const sx = Math.random() * width;
        const sy = Math.random() * height;
        const sr = Math.random() * (width / 150) + 1.5;

        ctx.save();
        ctx.translate(sx, sy);
        ctx.shadowBlur = sr * 3;
        ctx.shadowColor = `hsl(${hue}, 100%, 70%)`;
        ctx.fillStyle = "#ffffff";
        ctx.beginPath();
        // Draw 4-point star curve
        ctx.moveTo(0, -sr);
        ctx.quadraticCurveTo(0, 0, sr, 0);
        ctx.quadraticCurveTo(0, 0, 0, sr);
        ctx.quadraticCurveTo(0, 0, -sr, 0);
        ctx.quadraticCurveTo(0, 0, 0, -sr);
        ctx.fill();
        ctx.restore();
    }

    // 6. Draw the Magic Key on an Offscreen Canvas (To safely handle cut-outs)
    const keyCanvas = document.createElement('canvas');
    keyCanvas.width = width;
    keyCanvas.height = height;
    const kctx = keyCanvas.getContext('2d');

    const L = Math.min(width, height) * scale; // Overall length of the key
    const W = L / 12; // Thickness of shaft and common elements
    const R = L / 5;  // Radius of the bow (handle)

    kctx.save();
    kctx.translate(cx, cy);
    kctx.rotate(-Math.PI / 6); // Slant by -30 degrees

    // Setup Gold Gradient
    const goldGrad = kctx.createLinearGradient(-L/2, -R, L/2, R);
    goldGrad.addColorStop(0, "#fff59d");
    goldGrad.addColorStop(0.3, "#d4af37");
    goldGrad.addColorStop(0.7, "#8c6b12");
    goldGrad.addColorStop(1, "#fff8b3");
    kctx.fillStyle = goldGrad;

    kctx.beginPath();
    // Bow (Handle at left end)
    kctx.arc(-L/2, 0, R, 0, Math.PI * 2);
    // Central Shaft
    kctx.rect(-L/2, -W/2, L, W);
    // Tip Diamond
    kctx.moveTo(L/2, -W/2);
    kctx.lineTo(L/2 + W, 0);
    kctx.lineTo(L/2, W/2);
    // Teeth (Bits at right end)
    kctx.rect(L/2 - W*3.5, W/2, W*1.2, W*2);
    kctx.rect(L/2 - W*1.5, W/2, W*1.5, W*2.5);
    // Connector bit for teeth
    kctx.rect(L/2 - W*3.5, W*1.5, W*2, W);
    kctx.fill();

    // Key Cutouts (Destination Out)
    kctx.globalCompositeOperation = 'destination-out';
    
    kctx.beginPath();
    // Inner handle ring cutout
    kctx.arc(-L/2, 0, R - W, 0, Math.PI * 2);
    kctx.fill();

    // Small groove cutout in the teeth
    kctx.beginPath();
    kctx.rect(L/2 - W*2.5, W/2, W*0.5, W*1.2);
    kctx.fill();
    
    kctx.restore();

    // 7. Render Key onto Main Canvas with Magic Glow effect
    ctx.shadowBlur = blurIntensity;
    ctx.shadowColor = `hsl(${(hue + 20) % 360}, 100%, 65%)`;

    // Apply glow effect twice for intense neon magical effect
    ctx.drawImage(keyCanvas, 0, 0);
    ctx.drawImage(keyCanvas, 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 Image Key and Magic Effect Generator is a creative tool designed to transform standard images into mystical, fantasy-themed artwork. It applies a customizable color hue shift, a mysterious vignette, and a central magical aura to create an atmospheric glow. The tool also adds shimmering magic sparkles and overlays a stylized, glowing golden key silhouette onto the center of the image. This tool is ideal for digital artists, game developers, or social media enthusiasts looking to create enchanted assets, fantasy-themed profile pictures, or magical concept art.

Leave a Reply

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