Please bookmark this page to avoid losing your image tool!

Image NiSi Nano IR ND 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, stops = 3) {
    let currentStops;

    // Validate and parse the 'stops' parameter
    if (typeof stops === 'string') {
        currentStops = parseFloat(stops);
    } else if (typeof stops === 'number') {
        currentStops = stops;
    } else {
        // Fallback for other types (e.g., null, or if default somehow bypassed)
        // The function signature `stops = 3` handles 'undefined'.
        // This handles `null` or other unexpected types passed for `stops`.
        currentStops = 3;
    }

    // If parsing resulted in NaN, or if stops is negative, revert to a sensible default (e.g., 3 stops).
    // Or, if negative, it implies less light reduction or even brightening, which is not what ND filters do.
    // For negative stops, we could clamp to 0 (no effect). Let's opt for reverting to default for simplicity
    // if the value is not a valid, non-negative number of stops.
    if (isNaN(currentStops) || currentStops < 0) {
        currentStops = 3; // Default to 3 stops if input is invalid or negative
    }

    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');

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

    if (!imgWidth || !imgHeight) {
        // This typically means the image hasn't loaded or is invalid.
        // Return an empty canvas or handle error appropriately.
        // For now, setting a default small size to avoid 0x0 canvas issues.
        canvas.width = 1;
        canvas.height = 1;
        console.error("Image not loaded or has zero dimensions.");
        return canvas;
    }

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

    // Draw the original image onto a new canvas
    ctx.drawImage(originalImg, 0, 0, imgWidth, imgHeight);

    // If 0 stops, no darkening effect is applied. Return the canvas with the original image.
    if (currentStops === 0) {
        return canvas;
    }

    // Get the image data from the canvas
    const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    const data = imageData.data;

    // Calculate the light reduction factor. Each stop halves the light.
    // factor = (1/2) ^ stops = 0.5 ^ stops
    const factor = Math.pow(0.5, currentStops);

    // Apply the ND filter effect by reducing RGB values
    for (let i = 0; i < data.length; i += 4) {
        // R, G, B channels are multiplied by the factor
        data[i] = Math.round(data[i] * factor);     // Red
        data[i + 1] = Math.round(data[i + 1] * factor); // Green
        data[i + 2] = Math.round(data[i + 2] * factor); // Blue
        // Alpha channel (data[i + 3]) remains unchanged
    }

    // 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 Image NiSi Nano IR ND Filter Effect Tool allows users to apply a neutral density (ND) filter effect to images. By adjusting the number of stops, users can simulate the light reduction that ND filters provide, making this tool ideal for photography enthusiasts looking to modify exposure settings. Applications include enhancing landscape photos by enabling longer exposures to create motion blur in water or clouds, and achieving better control over depth of field in bright lighting conditions. This tool is useful for both editing digital images and preparing photos for professional presentations.

Leave a Reply

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

Other Image Tools:

Image Polaroid SX-70 Filter Effect Tool

Image Linhof Technika Filter Effect Tool

Image Lee Big Stopper 10-Stop ND Filter Effect Tool

Image Minolta X-700 Film Camera Render Effect Creator

Image ORWO UN54 Motion Picture Film Effect Applicator

Image Shen-Hao Large Format Filter Effect Tool

Image Impossible Project Polaroid Filter Effect Tool

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

See All →