Please bookmark this page to avoid losing your image tool!

Image Ilford FP4 Plus 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) {
    const canvas = document.createElement('canvas');
    const width = originalImg.naturalWidth || originalImg.width;
    const height = originalImg.naturalHeight || originalImg.height;

    // Handle cases where the image might not have valid dimensions
    if (width === 0 || height === 0) {
        canvas.width = 0;
        canvas.height = 0;
        // Optional: log a warning, but the main thing is to return a 0x0 canvas.
        // console.warn("Original image has zero width or height.");
        return canvas;
    }

    canvas.width = width;
    canvas.height = height;
    
    const ctx = canvas.getContext('2d');

    if (!ctx) {
        // This is highly unlikely for '2d' contexts in modern browsers
        // Fallback: return an empty canvas, or could throw.
        // console.error("Failed to get 2D context from canvas.");
        return canvas; // Return the empty, unconfigured canvas
    }

    // Draw the original image onto the canvas
    try {
        ctx.drawImage(originalImg, 0, 0, canvas.width, canvas.height);
    } catch (e) {
        // This might happen if originalImg is not a valid image source (e.g., not loaded, tainted)
        // console.error("Error drawing image to canvas:", e);
        // Return a canvas with an error message or just an empty canvas
        ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear canvas
        ctx.font = "16px Arial";
        ctx.fillStyle = "red";
        ctx.textAlign = "center";
        ctx.textBaseline = "middle";
        ctx.fillText("Error: Could not load image.", canvas.width / 2, canvas.height / 2);
        return canvas;
    }

    // Get image data. This can throw a SecurityError if the image is cross-origin and not CORS-enabled.
    let imageData;
    try {
        imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    } catch (e) {
        // console.error("Error getting image data (likely a CORS issue):", e);
        // Return a canvas with an error message explaining the likely CORS issue.
        // The original image is on the canvas, but we can't process it.
        // Clear it and show an error message.
        ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear canvas
        ctx.font = "14px Arial";
        ctx.fillStyle = "red";
        ctx.textAlign = "center";
        ctx.textBaseline = "middle";
        let msgLine1 = "Error: Could not process image.";
        let msgLine2 = "This might be due to cross-origin restrictions (CORS).";
        if (canvas.height < 40) { // If canvas too small, just one line
             ctx.fillText(msgLine1, canvas.width / 2, canvas.height / 2);
        } else {
            ctx.fillText(msgLine1, canvas.width / 2, canvas.height / 2 - 10);
            ctx.fillText(msgLine2, canvas.width / 2, canvas.height / 2 + 10);
        }
        return canvas;
    }
    
    const data = imageData.data;

    // Constants chosen to simulate Ilford FP4 Plus characteristics:
    // Fine grain, good sharpness (acutance), and wide tonal range with decent contrast.
    const contrastFactor = 1.15; // Provides a modest contrast boost, typical for FP4's "punch".
    const brightnessAdjust = -5;  // Slightly darkens the image, enhancing blacks, common in B&W printing.
    const grainStrength = 8;      // Simulates fine grain; FP4 Plus is known for its fine grain structure.

    for (let i = 0; i < data.length; i += 4) {
        const r = data[i];
        const g = data[i+1];
        const b = data[i+2];

        // Convert to grayscale using Rec.709 luma coefficients for perceptually accurate brightness.
        let lum = 0.2126 * r + 0.7152 * g + 0.0722 * b;

        // Apply contrast adjustment.
        // This formula scales the tonal range around the mid-point (128).
        lum = (lum - 128) * contrastFactor + 128;

        // Apply brightness adjustment.
        lum += brightnessAdjust;

        // Add fine grain.
        if (grainStrength > 0) {
            // Generate random noise between -grainStrength/2 and +grainStrength/2.
            const noise = (Math.random() - 0.5) * grainStrength;
            lum += noise;
        }

        // Clamp the luminosity value to ensure it remains within the valid [0, 255] range.
        lum = Math.max(0, Math.min(255, lum));

        // Apply the new grayscale value to R, G, and B channels.
        // Alpha channel (data[i+3]) is preserved.
        data[i] = lum;
        data[i+1] = lum;
        data[i+2] = lum;
    }

    // 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 Ilford FP4 Plus Filter Effect Tool allows users to apply a classic black and white film effect to their images, mimicking the characteristics of Ilford FP4 Plus film. This tool enhances contrast, slightly darkens images to enrich blacks, and introduces fine grain to replicate the aesthetic of traditional photography. It is ideal for photographers and artists looking to give their digital photos a vintage film-like appearance, making it suitable for creative projects, social media posts, or any occasion where a nostalgic touch is desired.

Leave a Reply

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

Other Image Tools:

Image Infrared 850nm Filter Effect Tool

Image Pentax 67 Medium Format Filter Effect Tool

Image ARRI Alexa Cinema Camera Filter Effect Enhancer

Image Cinestill 50D Filter Effect Application

Image Kodachrome 64 Filter Effect Tool

Photo Lomography Berlin Kino Filter Effect Tool

Image Fujifilm Neopan Filter Effect Tool

Image Polaroid Instant Film Filter Effect Tool

Image Holga Camera Filter Effect Tool

Image Fisheye Lens Distortion Filter Effect Tool

Image Kodak Gold 200 Film Filter Effect Tool

Photo Macro Filter Effect Tool

Image Neutral Density Filter Effect Tool

Image Green Filter Black And White Effect Tool

Image Large Format Film Filter Effect Creator

Image Pinhole Camera Filter Effect Tool

Image Warming Filter Effect Tool

Image Fujifilm Pro 400H Filter Effect Application

Image Diffusion Filter Effect Tool

Image Push-Processed Film Filter Effect Tool

Image Color Temperature Orange Filter Effect Tool

Image Kodak Ektar 100 Film Filter Effect

Image Yellow Filter Black And White Effect Tool

Image Expired Film Filter Effect Tool

Image Circular Polarizer Filter Effect Tool

Image Lomography Purple Filter Effect Tool

Image Split Field Filter Effect Tool

Image Soft Focus Filter Effect Tool

Image Medium Format Film Filter Effect

Image Wide-Angle Lens Perspective Filter Effect Tool

Olympus OM-1 Photo Filter Effect Tool

Image Fujifilm Velvia Filter Effect Tool

Image Lensbaby Selective Focus Filter Effect Tool

Image Color Temperature Blue Filter Effect Tool

Image UV Filter Effect Tool

Image Red Filter Black And White Effect Tool

See All →