Please bookmark this page to avoid losing your image tool!

Photo Night To Day Converter

(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, exposure = 1.8, gamma = 1.4, saturation = 1.3, blueBoost = 10) {
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');
    
    // Set canvas dimensions to match the original image
    canvas.width = originalImg.width;
    canvas.height = originalImg.height;
    
    // Draw the original image onto the canvas
    ctx.drawImage(originalImg, 0, 0);
    
    // Get the image data to manipulate pixels
    const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    const data = imageData.data;
    
    // Ensure parameters are numbers
    const exp = parseFloat(exposure);
    const gam = parseFloat(gamma);
    const sat = parseFloat(saturation);
    const bBoost = parseFloat(blueBoost);

    // Process each pixel
    for (let i = 0; i < data.length; i += 4) {
        let r = data[i];
        let g = data[i + 1];
        let b = data[i + 2];
        
        // 1. Exposure: Multiply pixels to brighten up the extremely dark night areas
        r *= exp;
        g *= exp;
        b *= exp;
        
        // 2. Gamma Correction: Lightens midtones and shadows more than highlights to prevent total blowout
        r = 255 * Math.pow(r / 255, 1 / gam);
        g = 255 * Math.pow(g / 255, 1 / gam);
        b = 255 * Math.pow(b / 255, 1 / gam);
        
        // 3. Color Balance / Blue Boost: Day scenes typically have more blue (sky ambient light)
        // Night photos often skew yellow/orange (street lights) or grey
        b += bBoost;
        
        // 4. Saturation: Brightening a dark image washes out colors, so we restore/boost them
        // Calculate relative luminance
        const lum = 0.299 * r + 0.587 * g + 0.114 * b;
        
        // Interpolate between luminance (grayscale) and the original color based on saturation factor
        r = lum + sat * (r - lum);
        g = lum + sat * (g - lum);
        b = lum + sat * (b - lum);
        
        // Clamp the RGB values between 0 and 255
        data[i]     = Math.min(255, Math.max(0, r));
        data[i + 1] = Math.min(255, Math.max(0, g));
        data[i + 2] = Math.min(255, Math.max(0, b));
        // data[i + 3] is alpha, which we leave untouched
    }
    
    // Put the processed 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 Night To Day Converter is an image processing tool designed to transform dark, nighttime photographs into brighter, daylight-simulated images. By adjusting exposure, gamma correction, color balance, and saturation, the tool brightens shadows, restores color vibrancy, and adjusts tones to mimic natural daytime lighting. This tool is useful for photographers looking to salvage underexposed shots, content creators wanting to change the mood of a scene, or anyone needing to make low-light imagery more visible and clear.

Leave a Reply

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