Please bookmark this page to avoid losing your image tool!

Pitch Wiggle Black 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, wiggleAmplitude = 25, waveLength = 50, pitchBlackThreshold = 80) {
    // Ensure parameters are numbers
    const amplitude = Number(wiggleAmplitude);
    const length = Number(waveLength) || 1; // Prevent division by zero
    const blackThreshold = Number(pitchBlackThreshold);

    // Create canvas and context
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');
    
    const width = originalImg.width;
    const height = originalImg.height;
    
    canvas.width = width;
    canvas.height = height;
    
    // Draw original image to get pixel data
    ctx.drawImage(originalImg, 0, 0);
    let imgData;
    try {
        imgData = ctx.getImageData(0, 0, width, height);
    } catch (e) {
        // Handle potential CORS issues if external images were passed (though against guidelines, good practice)
        return canvas;
    }
    
    const data = imgData.data;
    
    // Create new image data for the output
    const outputData = ctx.createImageData(width, height);
    const out = outputData.data;
    
    const frequency = (2 * Math.PI) / length;
    
    // Process pixel by pixel
    for (let y = 0; y < height; y++) {
        // Calculate the horizontal wiggle shift for the current row using a sine wave
        const shiftX = Math.round(Math.sin(y * frequency) * amplitude);
        
        for (let x = 0; x < width; x++) {
            const dstIdx = (y * width + x) * 4;
            const srcX = x - shiftX;
            
            // Check if the shifted reference pixel is within bounds
            if (srcX >= 0 && srcX < width) {
                const srcIdx = (y * width + srcX) * 4;
                
                const r = data[srcIdx];
                const g = data[srcIdx + 1];
                const b = data[srcIdx + 2];
                const a = data[srcIdx + 3];
                
                // Calculate luminance to apply the "Pitch Black" crushing effect
                const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
                
                if (luminance < blackThreshold) {
                    // Turn pixels below threshold to pitch black
                    out[dstIdx] = 0;
                    out[dstIdx + 1] = 0;
                    out[dstIdx + 2] = 0;
                    out[dstIdx + 3] = a; 
                } else {
                    // Keep original color for highlights
                    out[dstIdx] = r;
                    out[dstIdx + 1] = g;
                    out[dstIdx + 2] = b;
                    out[dstIdx + 3] = a;
                }
            } else {
                // Out of bounds (wiggled outside the image), wrap in pitch black
                out[dstIdx] = 0;
                out[dstIdx + 1] = 0;
                out[dstIdx + 2] = 0;
                out[dstIdx + 3] = 255;
            }
        }
    }
    
    // Place the processed data back onto the canvas
    ctx.putImageData(outputData, 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 Pitch Wiggle Black Image Effect Generator applies a wavy, distorted visual style to images by combining a horizontal sine-wave displacement with a high-contrast crushing effect. The tool shifts rows of pixels to create a ‘wiggle’ motion and converts all pixels below a certain luminance threshold into pitch black. This effect is ideal for creating stylized artistic portraits, glitch art, dramatic noir-style visuals, or abstract textures for graphic design projects.

Leave a Reply

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