Please bookmark this page to avoid losing your image tool!

Image Wrapper 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, 
    padding = 100, 
    wrapperBackground = '#8EC5FC,#E0C3FC', 
    macWindowStyle = 1, 
    windowColor = '#ffffff', 
    imagePadding = 0, 
    imageRadius = 16, 
    shadowBlur = 40, 
    shadowOffsetY = 20, 
    shadowColor = 'rgba(0,0,0,0.25)'
) {
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');
    
    // Calculate dimensions
    const topBarHeight = macWindowStyle === 1 ? 40 : 0;
    const innerWidth = originalImg.width + imagePadding * 2;
    const innerHeight = originalImg.height + imagePadding * 2 + topBarHeight;
    
    canvas.width = innerWidth + padding * 2;
    canvas.height = innerHeight + padding * 2;
    
    // Helper function to draw rounded rectangles
    const roundRect = (ctx, x, y, w, h, r) => {
        r = Math.min(r, w / 2, h / 2); // Prevent radius from overflowing bounds
        ctx.beginPath();
        ctx.moveTo(x + r, y);
        ctx.lineTo(x + w - r, y);
        ctx.quadraticCurveTo(x + w, y, x + w, y + r);
        ctx.lineTo(x + w, y + h - r);
        ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
        ctx.lineTo(x + r, y + h);
        ctx.quadraticCurveTo(x, y + h, x, y + h - r);
        ctx.lineTo(x, y + r);
        ctx.quadraticCurveTo(x, y, x + r, y);
        ctx.closePath();
    };

    // 1. Draw Outer Wrapper Background
    if (wrapperBackground.toLowerCase() !== 'transparent') {
        if (wrapperBackground.includes(',')) {
            // Support linear gradients separated by commas
            const colors = wrapperBackground.split(',').map(c => c.trim());
            const gradient = ctx.createLinearGradient(0, 0, canvas.width, canvas.height);
            colors.forEach((color, index) => {
                const position = index / (colors.length - 1 || 1);
                gradient.addColorStop(position, color);
            });
            ctx.fillStyle = gradient;
        } else {
            ctx.fillStyle = wrapperBackground;
        }
        ctx.fillRect(0, 0, canvas.width, canvas.height);
    }

    // 2. Draw Inner Window Container with Drop Shadow
    ctx.shadowColor = shadowColor;
    ctx.shadowBlur = shadowBlur;
    ctx.shadowOffsetX = 0;
    ctx.shadowOffsetY = shadowOffsetY;
    
    ctx.fillStyle = windowColor;
    roundRect(ctx, padding, padding, innerWidth, innerHeight, imageRadius);
    ctx.fill();

    // Reset shadow for inner elements
    ctx.shadowColor = 'transparent';
    ctx.shadowBlur = 0;
    ctx.shadowOffsetX = 0;
    ctx.shadowOffsetY = 0;

    // 3. Clip area rounded corners so image won't overflow the container
    ctx.save();
    roundRect(ctx, padding, padding, innerWidth, innerHeight, imageRadius);
    ctx.clip();

    // 4. Optionally draw Mac window controls (dots) on top bar
    if (macWindowStyle === 1) {
        const dotRadius = 6;
        const startX = padding + 20;
        const startY = padding + 20; // 40px top bar height means 20px is vertically centered
        
        const dotColors = ['#FF5F56', '#FFBD2E', '#27C93F'];
        dotColors.forEach((color, i) => {
            ctx.fillStyle = color;
            ctx.beginPath();
            ctx.arc(startX + i * 20, startY, dotRadius, 0, Math.PI * 2);
            ctx.fill();
        });
    }

    // 5. Draw the Original Image inside the window wrapper
    const imgX = padding + imagePadding;
    const imgY = padding + imagePadding + topBarHeight;
    ctx.drawImage(originalImg, imgX, imgY, originalImg.width, originalImg.height);

    // Render the final composition
    ctx.restore();

    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 Wrapper Tool allows you to enhance your images by placing them within stylized containers, such as a macOS-style window. Users can customize the appearance by adding gradient or solid color backgrounds, adjusting padding, setting corner radiuses, and applying soft drop shadows. This tool is ideal for content creators, designers, and marketers who want to create professional-looking mockups, presentation slides, or social media posts by giving standard screenshots or photos a polished, framed aesthetic.

Leave a Reply

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