Please bookmark this page to avoid losing your image tool!

Chromatic Aberration Image Effect Generator

(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,
    redShiftX = 6,
    redShiftY = 0,
    greenShiftX = 0,
    greenShiftY = 0,
    blueShiftX = -6,
    blueShiftY = 0
) {
    // Parse parameters to ensure they are handled as numbers
    const rX = Number(redShiftX);
    const rY = Number(redShiftY);
    const gX = Number(greenShiftX);
    const gY = Number(greenShiftY);
    const bX = Number(blueShiftX);
    const bY = Number(blueShiftY);

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

    // Output and working canvas setup
    const canvas = document.createElement('canvas');
    canvas.width = width;
    canvas.height = height;
    const ctx = canvas.getContext('2d');

    // Draw the original image to extract its pixel data
    ctx.drawImage(originalImg, 0, 0, width, height);

    const srcImageData = ctx.getImageData(0, 0, width, height);
    const dstImageData = ctx.createImageData(width, height);

    const srcData = srcImageData.data;
    const dstData = dstImageData.data;

    // Loop through every pixel to apply the channel shift
    for (let y = 0; y < height; y++) {
        for (let x = 0; x < width; x++) {
            const i = (y * width + x) * 4;
            let aR = 0, aG = 0, aB = 0;

            // Shift Red Channel
            const rx = x - rX;
            const ry = y - rY;
            if (rx >= 0 && rx < width && ry >= 0 && ry < height) {
                const rIndex = (ry * width + rx) * 4;
                dstData[i] = srcData[rIndex];
                aR = srcData[rIndex + 3];
            } else {
                dstData[i] = 0; // Black/empty bounds
            }

            // Shift Green Channel
            const gx = x - gX;
            const gy = y - gY;
            if (gx >= 0 && gx < width && gy >= 0 && gy < height) {
                const gIndex = (gy * width + gx) * 4;
                dstData[i + 1] = srcData[gIndex + 1];
                aG = srcData[gIndex + 3];
            } else {
                dstData[i + 1] = 0;
            }

            // Shift Blue Channel
            const bx = x - bX;
            const by = y - bY;
            if (bx >= 0 && bx < width && by >= 0 && by < height) {
                const bIndex = (by * width + bx) * 4;
                dstData[i + 2] = srcData[bIndex + 2];
                aB = srcData[bIndex + 3];
            } else {
                dstData[i + 2] = 0;
            }

            // Combine alpha max value to ensure edges generated by shifts are rendered accurately (even on transparent images)
            dstData[i + 3] = Math.max(srcData[i + 3], aR, aG, aB);
        }
    }

    // Apply the manipulated data object to the canvas
    ctx.putImageData(dstImageData, 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

This tool allows users to apply a chromatic aberration effect to images by independently shifting the red, green, and blue color channels along the X and Y axes. By displacing these color channels, the tool creates a stylized color-fringing effect commonly seen in vintage photography or digital glitch art. It is useful for graphic designers, digital artists, and content creators looking to add a retro, cinematic, or psychedelic aesthetic to their visual projects.

Leave a Reply

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

Other Image Tools:

Soft Focus Blur Image Effect Generator

Wii Menu Chirp Echo Image Effect Generator

Sunrise Bloom Image Effect Generator

Morning Mist Overlay Image Effect Generator

Dewdrop Refraction Image Effect Generator

Golden Hour Glow Image Effect Generator

Lights Out Movie Poster

Lights Out Sky Scream Roller Coaster Movie Poster Generator

Lights Out Sky Scream Roller Coaster Movie Poster Website Image

Lights Out Sky Scream Roller Coaster Movie Poster Image

Empty Texas State Driver License Generator

Editable Realistic State Driver License Photo Template Generator

Photo To Skype Incoming Call Video Converter for Mac

Photo To Skype Incoming Call Video Converter

Photo To Skype Incoming Call Background Converter

Photo To Video Trailer Creator

Cybernatural Conjuring Teaser Poster Generator

Unfriended Conjuring Movie Poster Image

Annabelle Comes Home Movie Poster

Annabelle Creation Movie Poster

Annabelle Movie Poster 2014

The Conjuring Last Rites Movie Poster

The Conjuring The Devil Made Me Do It Movie Poster

The Conjuring 2 Movie Poster

The Conjuring Movie Poster

Photo To Conjuring Title Card Sequence Converter

Image License Information Viewer

Image Moiré Effect Text Adder

Moiré Pattern Image Generator With Shapes and Decorative Elements

Video To Website Image Converter

Photo To AI Trailer Video Generator

Photo To AI Video Trailer Generator

Conjuring Style Video Closing Title Sequence AI Generator

Photo To Conjuring Style Video Closing Title Sequence Converter

The Conjuring Movie Poster Image Creator

Two Photo Side by Side Merger Tool

See All →