Please bookmark this page to avoid losing your image tool!

Image Software Program

(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.
/**
 * Applies a "software glitch" effect to an image, simulating digital distortion.
 * The effect includes random horizontal slicing, chromatic aberration, and scan lines.
 *
 * @param {Image} originalImg The original JavaScript Image object.
 * @param {number} intensity A number from 0 to 100 that controls the amount of color channel separation (chromatic aberration). Defaults to 30.
 * @param {number} sliceCount The number of random horizontal slices to displace. Higher numbers create more fragmentation. Defaults to 20.
 * @param {number} offsetAmount The maximum distance in pixels that the slices can be offset horizontally. Defaults to 50.
 * @returns {HTMLCanvasElement} A new canvas element with the glitch effect applied.
 */
function processImage(originalImg, intensity = 30, sliceCount = 20, offsetAmount = 50) {
    // Sanitize parameters to ensure they are within a reasonable range.
    const safeIntensity = Math.max(0, Math.min(100, intensity));
    const safeSliceCount = Math.max(0, Math.floor(sliceCount));
    const safeOffsetAmount = Math.max(0, offsetAmount);

    const canvas = document.createElement('canvas');
    // Using willReadFrequently can be a performance hint for browsers.
    const ctx = canvas.getContext('2d', {
        willReadFrequently: true
    });

    const {
        width,
        height
    } = originalImg;
    canvas.width = width;
    canvas.height = height;

    // 1. Draw the original image onto the canvas to have a base to work from.
    ctx.drawImage(originalImg, 0, 0, width, height);

    // 2. Apply horizontal slice glitches.
    // This simulates data corruption where chunks of the image are displaced horizontally.
    for (let i = 0; i < safeSliceCount; i++) {
        // Choose a random vertical start position for the slice.
        const startY = Math.random() * height;
        // Choose a random height for the slice.
        const sliceHeight = 1 + Math.random() * (height / 10);
        // Choose a random horizontal offset.
        const horizontalOffset = (Math.random() - 0.5) * 2 * safeOffsetAmount;

        // Ensure the slice doesn't go beyond the canvas boundary.
        const actualSliceHeight = Math.min(sliceHeight, height - startY);
        if (actualSliceHeight <= 0) continue;

        // Draw a slice of the canvas from its current state to a new offset position.
        ctx.drawImage(
            canvas, // The source is the canvas itself.
            0, // source X
            startY, // source Y
            width, // source width
            actualSliceHeight, // source height
            horizontalOffset, // destination X (with offset)
            startY, // destination Y
            width, // destination width
            actualSliceHeight // destination height
        );
    }

    // 3. Apply chromatic aberration (color channel shifting).
    // This mimics lens distortion or CRT monitor misalignments for a retro-digital feel.
    const imageData = ctx.getImageData(0, 0, width, height);
    const data = imageData.data;
    const originalData = Uint8ClampedArray.from(data);
    const shift = Math.floor(safeIntensity / 8);

    if (shift > 0) {
        for (let i = 0; i < data.length; i += 4) {
            // Shift the red channel to the left by 'shift' pixels.
            const redIndex = i - shift * 4;
            if (redIndex >= 0) {
                data[i] = originalData[redIndex]; // Red
            }

            // Shift the blue channel to the right by 'shift' pixels.
            const blueIndex = i + shift * 4;
            if (blueIndex < data.length - 2) {
                data[i + 2] = originalData[blueIndex + 2]; // Blue
            }
            // The green channel (data[i + 1]) remains in its original place.
        }
    }

    // Put the manipulated pixel data back onto the canvas.
    ctx.putImageData(imageData, 0, 0);

    // 4. Add subtle scan lines for a retro CRT monitor feel.
    for (let y = 0; y < height; y += 3) {
        ctx.fillStyle = 'rgba(20, 20, 20, 0.05)';
        ctx.fillRect(0, y, width, 1);
    }

    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 Software Program allows users to apply a unique ‘software glitch’ effect to images, simulating digital distortion. This tool incorporates elements such as random horizontal slicing, chromatic aberration (color channel separation), and subtle scan lines, resulting in a creative and retro feel to photos. It can be used for artistic projects, social media content, digital art creation, or to simply add an eye-catching effect to images for personal or professional use.

Leave a Reply

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