Please bookmark this page to avoid losing your image tool!

Photo Golden Hour Mood 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, intensity = 0.7, targetRedMultiplier = 1.2, targetGreenMultiplier = 1.1, targetBlueMultiplier = 0.85) {
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d', { willReadFrequently: true }); // willReadFrequently for performance if getImageData is used often

    // Ensure the image is loaded and has dimensions
    const imgWidth = originalImg.naturalWidth || originalImg.width;
    const imgHeight = originalImg.naturalHeight || originalImg.height;

    if (!imgWidth || !imgHeight) {
        console.error("Image is not loaded or has no dimensions.");
        // Return an empty canvas or throw an error, depending on desired behavior
        canvas.width = 0;
        canvas.height = 0;
        return canvas;
    }

    canvas.width = imgWidth;
    canvas.height = imgHeight;

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

    // If intensity is 0, no filter is applied, return the canvas with the original image
    if (intensity === 0) {
        return canvas;
    }

    // Get the image data from the canvas
    const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    const data = imageData.data; // This is a Uint8ClampedArray: [R,G,B,A, R,G,B,A, ...]

    // Calculate the effective multipliers based on the intensity
    // This uses linear interpolation: final_value = (1-intensity)*initial_value + intensity*target_value
    // For multipliers, the initial_value (no effect) is 1.0.
    const actualRedMultiplier = 1 * (1 - intensity) + targetRedMultiplier * intensity;
    const actualGreenMultiplier = 1 * (1 - intensity) + targetGreenMultiplier * intensity;
    const actualBlueMultiplier = 1 * (1 - intensity) + targetBlueMultiplier * intensity;

    // Iterate through each pixel (4 values at a time: R, G, B, A)
    for (let i = 0; i < data.length; i += 4) {
        const r = data[i];   // Red channel
        const g = data[i+1]; // Green channel
        const b = data[i+2]; // Blue channel
        // Alpha channel (data[i+3]) is left unchanged

        // Apply the multipliers
        let newR = r * actualRedMultiplier;
        let newG = g * actualGreenMultiplier;
        let newB = b * actualBlueMultiplier;

        // The Uint8ClampedArray automatically clamps values to the 0-255 range.
        // So, explicit Math.min(255, ...) or Math.max(0, ...) is not strictly necessary here,
        // but can be kept for clarity if preferred.
        // For this implementation, we will rely on the clamping behavior of Uint8ClampedArray.
        data[i]   = newR;
        data[i+1] = newG;
        data[i+2] = newB;
    }

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

    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 Photo Golden Hour Mood Filter is an online tool that allows users to apply a warm, golden-hour effect to their images. This filter enhances the red and green hues while slightly reducing the blue tones, providing a nostalgic and inviting atmosphere to your photos. Ideal for photographers, social media enthusiasts, and anyone looking to enhance their images’ mood, this tool can be utilized for personal or professional projects, including enhancing portraits, landscapes, and travel photos.

Leave a Reply

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