Please bookmark this page to avoid losing your image tool!

Intense Photo Filter Application

(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, contrastAmount = 1.5, saturationAmount = 1.5, brightnessAmount = 1.0) {
    // Create a new canvas element
    const canvas = document.createElement('canvas');

    // Set canvas dimensions to the original image's dimensions
    // Use naturalWidth/naturalHeight for the actual dimensions of the image,
    // as .width/.height can be affected by CSS or if the image isn't fully loaded (though it should be).
    canvas.width = originalImg.naturalWidth || originalImg.width;
    canvas.height = originalImg.naturalHeight || originalImg.height;

    // Get the 2D rendering context
    const ctx = canvas.getContext('2d');

    // Validate and prepare filter values
    // Default values from function signature are used if parameters are not provided.
    // If provided parameters are invalid (e.g., non-numeric strings, negative values),
    // fall back to sensible defaults and issue a warning.

    let c = Number(contrastAmount);
    if (isNaN(c) || c < 0) {
        console.warn(`Invalid value for contrastAmount: "${contrastAmount}". Using default 1.5 (150%).`);
        c = 1.5; // Default contrast factor
    }

    let s = Number(saturationAmount);
    if (isNaN(s) || s < 0) {
        console.warn(`Invalid value for saturationAmount: "${saturationAmount}". Using default 1.5 (150%).`);
        s = 1.5; // Default saturation factor
    }

    let b = Number(brightnessAmount);
    if (isNaN(b) || b < 0) {
        console.warn(`Invalid value for brightnessAmount: "${brightnessAmount}". Using default 1.0 (100%).`);
        b = 1.0; // Default brightness factor
    }

    // Construct the filter string for the canvas context
    // Values are multiplied by 100 to convert factors to percentages for CSS filter syntax
    const filters = [];
    filters.push(`contrast(${c * 100}%)`);
    filters.push(`saturate(${s * 100}%)`);
    filters.push(`brightness(${b * 100}%)`);
    
    ctx.filter = filters.join(' ');

    // Draw the original image onto the canvas. The filter will be applied during rendering.
    ctx.drawImage(originalImg, 0, 0, canvas.width, canvas.height);

    // Optional: Reset the filter if the context were to be reused for unfiltered drawings.
    // Not strictly necessary here as we are returning a new canvas with its own context.
    // ctx.filter = 'none'; 

    // Return the canvas element with the filtered image
    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 Intense Photo Filter Application allows users to enhance their images by adjusting key visual attributes such as contrast, saturation, and brightness. With configurable parameters, users can intensify the colors and visual appeal of their photos, making it suitable for various applications including social media posts, photography enhancements, and personal projects. Whether you’re looking to create vibrant images for a presentation or improve the aesthetics of your online content, this tool provides an easy and effective way to apply strong photo filters.

Leave a Reply

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