Please bookmark this page to avoid losing your image tool!

Image Truth Tester

(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.
async function processImage(originalImg, jpegQuality = "0.90", errorMultiplier = "20") {
    // This function performs Error Level Analysis (ELA) to test if an image has been manipulated.
    // It compares the original image with a re-compressed JPEG version.
    
    const quality = parseFloat(jpegQuality);
    const multiplier = parseFloat(errorMultiplier);

    const width = originalImg.naturalWidth || originalImg.width;
    const height = originalImg.naturalHeight || originalImg.height;

    // Create a canvas and draw the original image
    const canvas = document.createElement('canvas');
    canvas.width = width;
    canvas.height = height;
    
    const ctx = canvas.getContext('2d');
    ctx.drawImage(originalImg, 0, 0);
    
    // Get image data of the original image
    const origData = ctx.getImageData(0, 0, width, height);
    
    // Compress the canvas output to a JPEG to introduce characteristic compression artifacts
    const dataURL = canvas.toDataURL('image/jpeg', quality);
    
    // Load the newly compressed JPEG image
    const compressedImg = new Image();
    await new Promise((resolve, reject) => {
        compressedImg.onload = resolve;
        compressedImg.onerror = reject;
        compressedImg.src = dataURL;
    });
    
    // Draw the compressed image to grab its pixel data
    ctx.clearRect(0, 0, width, height);
    ctx.drawImage(compressedImg, 0, 0);
    const compData = ctx.getImageData(0, 0, width, height);
    
    // Create a new canvas to display the Error Level Analysis result
    const outCanvas = document.createElement('canvas');
    outCanvas.width = width;
    outCanvas.height = height;
    const outCtx = outCanvas.getContext('2d');
    const outData = outCtx.createImageData(width, height);
    
    // Calculate the absolute difference between the original and compressed pixels
    for (let i = 0; i < origData.data.length; i += 4) {
        outData.data[i]     = Math.min(255, Math.abs(origData.data[i] - compData.data[i]) * multiplier);     // R
        outData.data[i+1]   = Math.min(255, Math.abs(origData.data[i+1] - compData.data[i+1]) * multiplier); // G
        outData.data[i+2]   = Math.min(255, Math.abs(origData.data[i+2] - compData.data[i+2]) * multiplier); // B
        outData.data[i+3]   = 255; // Alpha
    }
    
    // Write back the ELA data
    outCtx.putImageData(outData, 0, 0);
    
    return outCanvas;
}

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 Truth Tester uses Error Level Analysis (ELA) to help identify potential manipulations in an image. By comparing the original image with a re-compressed version, the tool highlights differences in error levels that may indicate where an image has been digitally altered. This tool is useful for digital forensics, verifying the authenticity of online photographs, and detecting edits in media files.

Leave a Reply

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