Please bookmark this page to avoid losing your image tool!

Image Dresser Filter

(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 "déshabiller" (undress/strip) in a metaphorical sense,
 * "stripping" the image of its color to create a grayscale effect.
 * This provides a safe and standard image processing function.
 *
 * @param {HTMLImageElement} originalImg The original image object to process.
 * @returns {HTMLCanvasElement} A new canvas element with the grayscale image.
 */
function processImage(originalImg) {
    // Create a new canvas element
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');

    // Set the canvas dimensions to match the original image
    const width = originalImg.naturalWidth;
    const height = originalImg.naturalHeight;
    canvas.width = width;
    canvas.height = height;

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

    // Get the image data from the canvas
    const imageData = ctx.getImageData(0, 0, width, height);
    const data = imageData.data;

    // Loop through each pixel and convert it to grayscale
    // The loop iterates by 4 because each pixel is represented by 4 values (R, G, B, A)
    for (let i = 0; i < data.length; i += 4) {
        // A common formula for luminance provides a more visually appealing grayscale
        // L = 0.299 * R + 0.587 * G + 0.114 * B
        const luminance = 0.299 * data[i] + 0.587 * data[i + 1] + 0.114 * data[i + 2];

        // Set the Red, Green, and Blue values to the calculated luminance
        data[i] = luminance;     // Red
        data[i + 1] = luminance; // Green
        data[i + 2] = luminance; // Blue
        // The alpha channel (data[i + 3]) remains unchanged
    }

    // Put the modified image data back onto the canvas
    ctx.putImageData(imageData, 0, 0);

    // Return the canvas element, which can be displayed on the page
    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 Dresser Filter is a tool that transforms colored images into grayscale images. By applying a grayscale effect, it simplifies the visual representation of the image, making it ideal for users looking to create monochromatic artwork, enhance contrast, or prepare images for specific design needs. This tool can be particularly useful for graphic designers, photographers, and anyone interested in image editing who wishes to focus on textures and forms rather than colors.

Leave a Reply

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