Please bookmark this page to avoid losing your image tool!

Image Impossible Project Polaroid Filter Effect Tool

(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,
    tintColorStr = "255,230,200", // Default: Warm yellow-ish tint (R,G,B string)
    tintOpacity = 0.15,          // Default: 0.15 (0-1 range, how much tint to apply)
    saturation = 0.85,           // Default: 0.85 (0=grayscale, 1=original, >1 more saturated)
    contrast = 1.1,              // Default: 1.1 (1=original, >1 more contrast, <1 less contrast)
    brightness = 1.05,           // Default: 1.05 (1=original, >1 brighter, <1 darker)
    vignetteStrength = 0.5,      // Default: 0.5 (0-1 range, intensity of vignette)
    vignetteStart = 0.3,         // Default: 0.3 (0=center, 1=image edge, where vignette begins)
    vignetteEnd = 0.85,          // Default: 0.85 (0=center, 1=image edge, where vignette is full strength, must be > vignetteStart)
    grainAmount = 12             // Default: 12 (0 for no grain, typical range 0-50 for subtle to noticeable grain)
) {
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d', { willReadFrequently: true }); // Opt-in for performance if available

    // Ensure image dimensions are from natural size for accuracy
    canvas.width = originalImg.naturalWidth || originalImg.width;
    canvas.height = originalImg.naturalHeight || originalImg.height;

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

    // Get image data to manipulate pixels
    const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    const data = imageData.data;
    const width = canvas.width;
    const height = canvas.height;

    // Parse tint color string into RGB components
    const [tintR, tintG, tintB] = tintColorStr.split(',').map(Number);

    // Pre-calculate values for vignette
    const centerX = width / 2;
    const centerY = height / 2;
    // Maximum distance from center to a corner, used for normalizing distances
    const maxRadialDist = Math.sqrt(centerX * centerX + centerY * centerY);

    // Helper function to clamp color values between 0 and 255
    const clamp = (value) => Math.max(0, Math.min(255, Math.round(value)));

    // Iterate over each pixel (RGBA components)
    for (let i = 0; i < data.length; i += 4) {
        let r = data[i];
        let g = data[i + 1];
        let b = data[i + 2];

        // 1. Apply Brightness
        if (brightness !== 1.0) {
            r *= brightness;
            g *= brightness;
            b *= brightness;
        }

        // 2. Apply Tint
        if (tintOpacity > 0 && !isNaN(tintR) && !isNaN(tintG) && !isNaN(tintB)) {
            r = r * (1 - tintOpacity) + tintR * tintOpacity;
            g = g * (1 - tintOpacity) + tintG * tintOpacity;
            b = b * (1 - tintOpacity) + tintB * tintOpacity;
        }

        // 3. Apply Saturation
        if (saturation !== 1.0) {
            // Calculate luminance (standard weights for perceived brightness)
            const lum = 0.299 * r + 0.587 * g + 0.114 * b;
            r = lum + saturation * (r - lum);
            g = lum + saturation * (g - lum);
            b = lum + saturation * (b - lum);
        }
        
        // 4. Apply Contrast
        if (contrast !== 1.0) {
            // Formula: NewValue = (((OldValue/255 - 0.5) * ContrastFactor) + 0.5) * 255
            r = (r / 255 - 0.5) * contrast + 0.5;
            g = (g / 255 - 0.5) * contrast + 0.5;
            b = (b / 255 - 0.5) * contrast + 0.5;
            r *= 255;
            g *= 255;
            b *= 255;
        }

        // Clamp intermediate color values to prevent overflow/underflow before spatial effects
        r = clamp(r);
        g = clamp(g);
        b = clamp(b);

        // 5. Apply Vignette
        // Ensure vignetteStrength is positive and vignetteEnd is meaningfully greater than vignetteStart
        if (vignetteStrength > 0 && vignetteEnd > vignetteStart && maxRadialDist > 0) {
            const pixelX = (i / 4) % width;
            const pixelY = Math.floor((i / 4) / width);
            
            const deltaX = pixelX - centerX;
            const deltaY = pixelY - centerY;
            const distFromCenter = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
            
            // Normalize distance: 0 at center, 1 at maxRadialDist (corners)
            const normalizedDist = distFromCenter / maxRadialDist;

            if (normalizedDist >= vignetteStart) {
                // Calculate how far into the vignette effect region (from vignetteStart to vignetteEnd) this pixel is
                // progress will be 0 at vignetteStart, and 1 at or beyond vignetteEnd
                const progress = Math.min(1, Math.max(0, (normalizedDist - vignetteStart) / (vignetteEnd - vignetteStart)));
                
                // Apply a power to the progress for a smoother falloff (exponent > 1 means faster falloff near vignetteEnd)
                const reduction = vignetteStrength * Math.pow(progress, 1.5); 
                const vignetteFactor = 1.0 - reduction;
                
                r *= vignetteFactor;
                g *= vignetteFactor;
                b *= vignetteFactor;
            }
        }

        // 6. Apply Grain
        if (grainAmount > 0) {
            // Add a random value (monochrome noise) to each channel
            const grain = (Math.random() - 0.5) * grainAmount;
            r += grain;
            g += grain;
            b += grain;
        }

        // Final Clamp for all color values
        data[i] = clamp(r);
        data[i + 1] = clamp(g);
        data[i + 2] = clamp(b);
        // Alpha channel (data[i + 3]) remains unchanged
    }

    // Put the modified pixel 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 Image Impossible Project Polaroid Filter Effect Tool allows users to apply a classic Polaroid-style filter to their images, enhancing them with various artistic effects. Users can adjust parameters such as tint color, saturation, contrast, brightness, vignette strength, and grain amount to achieve the desired look. This tool is ideal for those who want to creatively enhance their photos for use on social media, in digital art projects, or for personal prints, giving images a nostalgic and unique feel.

Leave a Reply

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

Other Image Tools:

Photo Foma Retropan 320 Film Filter Effect Tool

Image Fuji QuickSnap Disposable Filter Effect Application

Image 220 Film Format Filter Effect

Image Black and White with Green #61 Filter Effect Tool

Image 35mm Panoramic Camera Filter Effect Tool

Image Hitech Firecrest ND Filter Effect Formatter

Photo Rodenstock Digital Vario ND Filter Effect Tool

Image Leica Yellow Filter Effect Application

Image Argus C3 Vintage Camera Filter Effect

Image ORWO NP22 Film Filter Effect Application

Image Wratten #25 Red Filter Effect Tool

Image Helios 44-2 Swirly Bokeh Effect Filter

Image Fujifilm ETERNA Motion Picture Film Effect Applicator

Image Fujifilm FP-100C Instant Film Effect Filter

Image Canon AE-1 Film Camera Render Effect

Photo B+W Dark Red #29 Filter Effect Application

Image Toy Camera Effect Enhancer

Photo Graflex Speed Graphic Filter Effect Tool

Image Konica Hexar AF Filter Effect Application

Image Ricoh GR Film Camera Filter Effect Application

Image Kodak Disposable Camera Filter Effect

Image Hoya Pro ND Filter Effect Application

Image Wratten #12 Yellow Filter Effect Tool

Image AGFA APX 100 Film Filter Effect Tool

Image Singh-Ray Vari-ND Filter Effect Application

Image Rollei RPX 25 Film Filter Effect Tool

Image 35mm Half-frame Camera Filter Effect

Image Kodak Vision3 250D Motion Picture Film Effect Filter

Image 120 Film Format Filter Effect

Image Lens Whacking Filter Effect Tool

Image Black and White Red Filter Effect Tool

Image Lee Medium Stopper 6-Stop ND Filter Effect Tool

Image Nikon F3 Film Camera Render Effect Tool

Image Polaroid Spectra Filter Effect Tool

Image Contax T2/T3 Filter Effect Application

Image Bronica ETRS Medium Format Filter Effect Application

See All →