Please bookmark this page to avoid losing your image tool!

Image Of A Dog And A Cat Being Friends With 10 Puppies

(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.
/**
 * This function interprets the request "Image Of A Dog And A Cat Being Friends With 10 Puppies"
 * by taking an existing image and drawing a cartoon scene of the described animals on top of it.
 * The original image is used as the background for this new scene.
 *
 * @param {Image} originalImg The original image object to be used as a background.
 * @param {string} dogColor The color of the main dog.
 * @param {string} catColor The color of the main cat.
 * @param {string} puppyColor The color of the 10 puppies.
 * @param {number} scale A number to scale the size of the drawn animals.
 * @returns {HTMLCanvasElement} A canvas element with the original image and the drawn scene.
 */
function processImage(originalImg, dogColor = 'saddlebrown', catColor = '#666666', puppyColor = '#D2B48C', scale = 1.0) {
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');

    canvas.width = originalImg.naturalWidth;
    canvas.height = originalImg.naturalHeight;

    // Draw the original image as the background
    ctx.drawImage(originalImg, 0, 0, canvas.width, canvas.height);

    /**
     * Helper function to draw a simple cartoon dog.
     * By default, it faces left. A negative flip value makes it face right.
     */
    const drawDog = (x, y, size, color, flip = 1) => {
        ctx.save();
        ctx.translate(x, y);
        ctx.scale(flip, 1); // Used for flipping the direction

        // Tail
        ctx.beginPath();
        ctx.moveTo(size * 0.8, -size * 0.1);
        ctx.quadraticCurveTo(size * 1.2, -size * 0.8, size * 1.0, -size * 0.5);
        ctx.lineWidth = size * 0.15;
        ctx.lineCap = 'round';
        ctx.strokeStyle = color;
        ctx.stroke();

        // Body and Legs
        ctx.fillStyle = color;
        // Back legs
        ctx.fillRect(size * 0.4, size * 0.1, size * 0.2, size * 0.4);
        ctx.fillRect(-size * 0.2, size * 0.1, size * 0.2, size * 0.4);
        // Body
        ctx.beginPath();
        ctx.ellipse(0, 0, size * 0.9, size * 0.45, 0, 0, 2 * Math.PI);
        ctx.fill();
        // Front legs
        ctx.fillRect(-size * 0.6, size * 0.1, size * 0.2, size * 0.4);

        // Head
        ctx.beginPath();
        ctx.arc(-size * 0.8, -size * 0.4, size * 0.4, 0, 2 * Math.PI);
        ctx.fill();

        // Ears
        ctx.beginPath();
        ctx.ellipse(-size * 0.8, -size * 0.8, size * 0.15, size * 0.3, -Math.PI / 6, 0, 2 * Math.PI);
        ctx.fill();

        // Snout
        ctx.beginPath();
        ctx.arc(-size * 1.15, -size * 0.35, size * 0.18, 0, 2 * Math.PI);
        ctx.fill();

        // Eyes and Nose
        ctx.fillStyle = 'black';
        ctx.beginPath();
        ctx.arc(-size * 0.95, -size * 0.5, size * 0.05, 0, 2 * Math.PI); // Eye
        ctx.fill();
        ctx.beginPath();
        ctx.arc(-size * 1.3, -size * 0.35, size * 0.07, 0, 2 * Math.PI); // Nose
        ctx.fill();

        ctx.restore();
    };

    /**
     * Helper function to draw a simple cartoon cat.
     * By default, it faces left. A negative flip value makes it face right.
     */
    const drawCat = (x, y, size, color, flip = 1) => {
        ctx.save();
        ctx.translate(x, y);
        ctx.scale(flip, 1);

        // Tail
        ctx.beginPath();
        ctx.moveTo(size * 0.7, 0);
        ctx.bezierCurveTo(size * 1.2, -size * 1.2, size * 0.6, -size * 1.5, size * 0.8, -size * 0.8);
        ctx.lineWidth = size * 0.1;
        ctx.lineCap = 'round';
        ctx.strokeStyle = color;
        ctx.stroke();

        // Body and Legs
        ctx.fillStyle = color;
        // Back Legs
        ctx.fillRect(size * 0.4, size * 0.2, size * 0.15, size * 0.3);
        ctx.fillRect(0, size * 0.2, size * 0.15, size * 0.3);
        // Body
        ctx.beginPath();
        ctx.ellipse(0, 0, size * 0.8, size * 0.4, 0, 0, 2 * Math.PI);
        ctx.fill();
        // Front Legs
        ctx.fillRect(-size * 0.5, size * 0.2, size * 0.15, size * 0.3);

        // Head
        ctx.beginPath();
        ctx.arc(-size * 0.7, -size * 0.5, size * 0.35, 0, 2 * Math.PI);
        ctx.fill();

        // Ears
        ctx.beginPath();
        ctx.moveTo(-size * 0.9, -size * 0.8);
        ctx.lineTo(-size * 0.8, -size * 1.1);
        ctx.lineTo(-size * 0.7, -size * 0.8);
        ctx.closePath();
        ctx.fill();
        ctx.beginPath();
        ctx.moveTo(-size * 0.6, -size * 0.8);
        ctx.lineTo(-size * 0.5, -size * 1.1);
        ctx.lineTo(-size * 0.4, -size * 0.8);
        ctx.closePath();
        ctx.fill();

        // Eyes
        ctx.fillStyle = 'black';
        ctx.beginPath();
        ctx.arc(-size * 0.8, -size * 0.5, size * 0.04, 0, 2 * Math.PI);
        ctx.fill();

        // Whiskers
        const noseX = -size * 0.95;
        const noseY = -size * 0.45;
        ctx.strokeStyle = 'black';
        ctx.lineWidth = size * 0.015;
        ctx.beginPath();
        ctx.moveTo(noseX, noseY);
        ctx.lineTo(noseX - size * 0.2, noseY - size * 0.05);
        ctx.moveTo(noseX, noseY);
        ctx.lineTo(noseX - size * 0.2, noseY);
        ctx.moveTo(noseX, noseY);
        ctx.lineTo(noseX - size * 0.2, noseY + size * 0.05);
        ctx.stroke();

        ctx.restore();
    };

    // --- Main Drawing Logic ---

    const baseSize = Math.min(canvas.width, canvas.height) / 12 * Math.max(0.1, scale);
    const groundY = canvas.height * 0.85;
    const centerX = canvas.width / 2;

    // Draw the main cat and dog facing each other to show friendship.
    // The cat faces right (flipped), the dog faces left (default).
    drawCat(centerX - baseSize * 1.2, groundY, baseSize, catColor, -1);
    drawDog(centerX + baseSize * 0.8, groundY, baseSize * 1.2, dogColor, 1);

    // Draw 10 puppies scattered playfully around the main animals.
    const puppySize = baseSize * 0.5;
    for (let i = 0; i < 10; i++) {
        // Distribute puppies in a circular area
        const angle = Math.random() * Math.PI * 2;
        const radius = baseSize * 2 + Math.random() * baseSize * 4;
        const px = centerX + Math.cos(angle) * radius;
        // Keep puppies on the "ground" with some random scatter
        const py = groundY + Math.random() * baseSize;

        // Randomly flip some puppies to face different directions
        const flip = Math.random() > 0.5 ? -1 : 1;
        drawDog(px, py, puppySize, puppyColor, flip);
    }

    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

This tool generates a whimsical cartoon scene featuring a dog and a cat as friends surrounded by ten playful puppies. Users can upload an original image to serve as the background for the scene. The tool allows customization of the colors for the dog, cat, and puppies, as well as the size of the drawn animals. This utility is great for creating fun and unique images for personal use, social media posts, or lighthearted gifts.

Leave a Reply

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