Please bookmark this page to avoid losing your image tool!

Image Haze Look 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.
function processImage(originalImg, hazeColor = "rgba(230, 230, 250, 0.3)", brightness = 105, contrast = 95, saturation = 85, blurAmount = 0.5) {
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');

    // Ensure originalImg is properly loaded and has dimensions
    if (!originalImg.complete || originalImg.naturalWidth === 0 || originalImg.naturalHeight === 0) {
        console.warn("Image is not fully loaded or has zero dimensions. Returning a small empty canvas.");
        // Return a minimal canvas to avoid errors downstream if a canvas is expected
        canvas.width = 1;
        canvas.height = 1;
        ctx.fillStyle = 'red'; // Indicate error visually
        ctx.fillRect(0,0,1,1);
        return canvas;
    }

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

    // Construct the filter string for image adjustments
    // These adjustments contribute to the "hazy" appearance by altering
    // brightness, reducing contrast, and desaturating colors.
    // A slight blur can also enhance the effect.
    const filters = [];
    
    // Add blur if specified and greater than 0
    if (typeof blurAmount === 'number' && blurAmount > 0) {
        filters.push(`blur(${blurAmount}px)`);
    }

    // Add brightness adjustment
    if (typeof brightness === 'number') {
        filters.push(`brightness(${brightness}%)`);
    }

    // Add contrast adjustment
    if (typeof contrast === 'number') {
        filters.push(`contrast(${contrast}%)`);
    }

    // Add saturation adjustment
    if (typeof saturation === 'number') {
        filters.push(`saturate(${saturation}%)`);
    }
    
    if (filters.length > 0) {
        ctx.filter = filters.join(' ');
    } else {
        ctx.filter = 'none';
    }

    // Draw the original image onto the canvas.
    // The filters (if any) will be applied during this drawing operation.
    ctx.drawImage(originalImg, 0, 0, canvas.width, canvas.height);

    // Reset filters before drawing the haze overlay.
    // This is crucial so that the hazeColor itself is not brightened, contrasted, etc.
    ctx.filter = 'none';

    // Draw the haze color overlay.
    // The `hazeColor` (including its alpha component) determines the tint and intensity of the haze.
    if (typeof hazeColor === 'string' && hazeColor.trim() !== '') {
        ctx.fillStyle = hazeColor;
        ctx.fillRect(0, 0, canvas.width, canvas.height);
    }

    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 Haze Look Filter tool allows users to apply a soft haze effect to their images, enhancing them with customizable brightness, contrast, saturation, and blur settings. This tool can be useful for photographers looking to create a dreamy look or for graphic designers wanting to add a subtle atmosphere to their visuals. Whether in digital art, social media posts, or personal photo enhancements, this filter helps achieve a unique aesthetic by overlaying a haze color and adjusting image parameters.

Leave a Reply

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