Please bookmark this page to avoid losing your image tool!

Image Sadness Effect Adder

(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 = 50) {
    // Parse the intensity to ensure it's a valid number between 0 and 100
    let intensityVal = Number(intensity);
    if (isNaN(intensityVal)) intensityVal = 50;
    
    const sadFactor = Math.min(Math.max(intensityVal, 0), 100) / 100;
    
    // Create an off-screen canvas
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');
    
    // Set canvas dimensions to match the source image
    const width = originalImg.width || originalImg.naturalWidth;
    const height = originalImg.height || originalImg.naturalHeight;
    canvas.width = width;
    canvas.height = height;
    
    // Draw the original image onto the canvas
    ctx.drawImage(originalImg, 0, 0, width, height);
    
    if (sadFactor === 0) {
        return canvas;
    }
    
    // Get image data to manipulate pixels
    const imageData = ctx.getImageData(0, 0, width, height);
    const data = imageData.data;
    
    for (let i = 0; i < data.length; i += 4) {
        let r = data[i];
        let g = data[i+1];
        let b = data[i+2];
        
        // 1. Desaturation (fade towards gray for a lifeless feel)
        let gray = 0.299 * r + 0.587 * g + 0.114 * b;
        let desatFactor = sadFactor * 0.85; // Up to 85% desaturated
        r = r + (gray - r) * desatFactor;
        g = g + (gray - g) * desatFactor;
        b = b + (gray - b) * desatFactor;
        
        // 2. Darkening (lower overall exposure)
        let darkFactor = 1 - (0.3 * sadFactor);
        r *= darkFactor;
        g *= darkFactor;
        b *= darkFactor;
        
        // 3. Cold/Blue Tint (decrease reds/yellows, slightly boost blues)
        r = r - (r * 0.15 * sadFactor);
        g = g - (g * 0.05 * sadFactor);
        b = b + ((255 - b) * 0.12 * sadFactor);
        
        // Update pixel array
        data[i] = r;
        data[i+1] = g;
        data[i+2] = b;
    }
    
    // Put modified pixels back
    ctx.putImageData(imageData, 0, 0);
    
    // 4. Vignette Effect (Darken edges to create a sense of isolation)
    const cx = width / 2;
    const cy = height / 2;
    const radius = Math.max(cx, cy) * 1.3;
    
    const gradient = ctx.createRadialGradient(cx, cy, radius * 0.35, cx, cy, radius);
    gradient.addColorStop(0, 'rgba(0, 0, 0, 0)');
    // A dark bluish-black for the outer vignette edges
    gradient.addColorStop(1, `rgba(0, 10, 25, ${0.85 * sadFactor})`); 
    
    ctx.fillStyle = gradient;
    ctx.fillRect(0, 0, width, 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 Sadness Effect Adder is a tool designed to modify images to evoke a melancholy or somber mood. It achieves this by applying a combination of desaturation to reduce color vibrancy, lowering overall exposure, adding a cold blue tint, and applying a dark vignette around the edges to create a sense of isolation. This tool can be used by digital artists, content creators, or social media users looking to enhance the emotional storytelling of their photos or create specific atmospheric aesthetics for creative projects.

Leave a Reply

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