Please bookmark this page to avoid losing your image tool!

Text Based Fibonacci Wall Art Designer

(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,
    textStr = "",
    bgHex = "#000000",
    baseSize = 8,
    scaleFactor = 0.15,
    expansion = 0.30635,
    opacity = 1.0,
    startRadius = 5,
    letterSpacing = 0.05
) {
    // Basic setup for the main canvas
    const canvas = document.createElement("canvas");
    const width = originalImg.width;
    const height = originalImg.height;
    canvas.width = width;
    canvas.height = height;
    const ctx = canvas.getContext("2d");

    // Draw background color
    ctx.fillStyle = bgHex;
    ctx.fillRect(0, 0, width, height);

    // Setup off-screen canvas to extract image pixel colors
    const offCanvas = document.createElement("canvas");
    offCanvas.width = width;
    offCanvas.height = height;
    const offCtx = offCanvas.getContext("2d");
    offCtx.drawImage(originalImg, 0, 0);
    const imgData = offCtx.getImageData(0, 0, width, height).data;

    // Build the string to be traced
    let textToDraw = textStr.trim();
    if (textToDraw === "") {
        // Generate actual Fibonacci series using BigInt if no custom text is provided
        let a = 1n;
        let b = 1n;
        const fibList = ["1", "1"];
        for (let i = 0; i < 200; i++) {
            let c = a + b;
            fibList.push(c.toString());
            a = b;
            b = c;
        }
        textToDraw = fibList.join(" ") + " ";
    } else {
        // Enforce spacing on custom strings to make them wrap smoothly
        textToDraw += " ";
    }

    const cx = width / 2;
    const cy = height / 2;
    // Spiral needs to cover the corners, so maximum radius is the diagonal
    const maxR = Math.hypot(width / 2, height / 2) * 1.5;

    // Math parameters for the Logarithmic/Golden Spiral
    // r = a * e^(b * theta)
    const a_param = Math.max(1, Number(startRadius));
    const b_param = Math.max(0.01, Number(expansion)); // prevent b=0 which causes flat circles (infinite loop)
    const scaleFactorNum = Number(scaleFactor);
    const baseSizeNum = Number(baseSize);
    const letterSpacingNum = Number(letterSpacing);
    const opacityNum = Number(opacity);

    let theta = 0;
    let charIndex = 0;
    const fontFamily = "Courier New, monospace";

    while (true) {
        // Compute radius for current angle
        const r = a_param * Math.exp(b_param * theta);
        
        if (r > maxR) {
            break; // Stop when the spiral reaches outside the visible canvas bounds
        }
        
        // Safeguard to prevent an infinite loop in extreme scenarios
        if (theta > 5000) {
            break; 
        }

        const char = textToDraw[charIndex % textToDraw.length];

        // Dynamic font size gives the classic "zoom" golden spiral illusion
        let currentSize = baseSizeNum + (r * scaleFactorNum);
        currentSize = Math.max(1, currentSize); // Minimum 1px font size

        ctx.font = `bold ${currentSize}px ${fontFamily}`;
        ctx.textBaseline = "middle";
        ctx.textAlign = "left";
        const w = ctx.measureText(char).width;

        // Position coordinates
        const x = cx + r * Math.cos(theta);
        const y = cy + r * Math.sin(theta);

        // Fetch the nearest pixel color from the original image data
        const px = Math.floor(x);
        const py = Math.floor(y);
        let colorOutput = "rgba(0,0,0,0)";

        if (px >= 0 && px < width && py >= 0 && py < height) {
            const idx = (py * width + px) * 4;
            colorOutput = `rgba(${imgData[idx]}, ${imgData[idx + 1]}, ${imgData[idx + 2]}, ${opacityNum})`;
        }

        // To make the text flow along the curve, compute tangent angle derivative
        const dx = r * (b_param * Math.cos(theta) - Math.sin(theta));
        const dy = r * (b_param * Math.sin(theta) + Math.cos(theta));
        const angle = Math.atan2(dy, dx);

        // Only draw if we're technically inside the canvas bounding area (avoids unnecessary off-screen drawing)
        if (colorOutput !== "rgba(0,0,0,0)") {
            ctx.save();
            ctx.translate(x, y);
            ctx.rotate(angle);
            ctx.fillStyle = colorOutput;
            ctx.fillText(char, 0, 0);
            ctx.restore();
        }

        // Advance theta proportional to the written character's width along the spiral arc length
        // Arc length ds ≈ w + spacing -> dt = ds / sqrt((dr/dt)^2 + (r)^2)
        const ds = w + (currentSize * letterSpacingNum);
        const denominator = r * Math.sqrt(1 + (b_param * b_param));
        let dTheta = ds / denominator;

        // Ensure we advance forward a tiny bit at scale to prevent getting stuck
        if (dTheta < 0.002) dTheta = 0.002;

        theta += dTheta;
        charIndex++;
    }

    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 Text Based Fibonacci Wall Art Designer is a creative tool that transforms images into artistic spiral compositions using text. By following a logarithmic golden spiral pattern, the tool arranges characters—either a custom string provided by the user or a sequence of Fibonacci numbers—to trace the contours and colors of an uploaded image. Users can customize the design with various parameters such as background color, font size, scale, opacity, and letter spacing. This tool is ideal for generating unique digital art, personalized typography posters, or stylized graphic elements for home decor and creative projects.

Leave a Reply

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