You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, distortionIntensity = "15", colorShiftIntensity = "3", applyMemeOverlay = "true") {
// Create the canvas and context
const canvas = document.createElement('canvas');
const w = originalImg.width;
const h = originalImg.height;
canvas.width = w;
canvas.height = h;
const ctx = canvas.getContext('2d');
// Draw the original image to extract its pixel data
ctx.drawImage(originalImg, 0, 0);
const srcData = ctx.getImageData(0, 0, w, h).data;
const outImageData = ctx.createImageData(w, h);
const outData = outImageData.data;
// Parse parameters
const dist = parseFloat(distortionIntensity) || 15;
const shift = parseFloat(colorShiftIntensity) || 3;
const overlay = applyMemeOverlay.toLowerCase() === "true";
// Applying the "Bob Dominator Major" pixel distortion and chromatic effect
for (let y = 0; y < h; y++) {
for (let x = 0; x < w; x++) {
// "Dominator" Wave distortion (sinusoidal wobble)
const waveX = x + Math.sin(y / 20) * dist;
const waveY = y + Math.cos(x / 20) * dist;
// "Major" Chromatic Aberration map (RGB splitting)
const rx = Math.max(0, Math.min(w - 1, waveX + shift * 4)) | 0;
const cx = Math.max(0, Math.min(w - 1, waveX)) | 0;
const bx = Math.max(0, Math.min(w - 1, waveX - shift * 4)) | 0;
const sy = Math.max(0, Math.min(h - 1, waveY)) | 0;
// Find base indices for the split channels
const idxR = (sy * w + rx) * 4;
const idxG = (sy * w + cx) * 4;
const idxB = (sy * w + bx) * 4;
const outIdx = (y * w + x) * 4;
// Intense deep-fried contrast for "Dominator" effect
const contrast = 2.5;
const r = srcData[idxR];
const g = srcData[idxG + 1];
const b = srcData[idxB + 2];
const a = srcData[idxG + 3];
// Apply contrast and save to output
outData[outIdx] = Math.min(255, Math.max(0, ((r / 255 - 0.5) * contrast + 0.5) * 255));
outData[outIdx + 1] = Math.min(255, Math.max(0, ((g / 255 - 0.5) * contrast + 0.5) * 255));
outData[outIdx + 2] = Math.min(255, Math.max(0, ((b / 255 - 0.5) * contrast + 0.5) * 255));
outData[outIdx + 3] = a;
}
}
// Put manipulated pixels back onto the canvas
ctx.putImageData(outImageData, 0, 0);
if (overlay) {
// Adds the characteristic intense neon/fiery "Major" overlay
const gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(w,h)/1.5);
gradient.addColorStop(0, 'rgba(255, 60, 0, 0.4)');
gradient.addColorStop(1, 'rgba(0, 0, 150, 0.6)');
ctx.fillStyle = gradient;
ctx.globalCompositeOperation = "color-dodge";
ctx.fillRect(0, 0, w, h);
// Add a dark heavy vignette for maximum dominance feel
ctx.globalCompositeOperation = "multiply";
const vig = ctx.createRadialGradient(w/2, h/2, Math.min(w,h)/3, w/2, h/2, Math.max(w,h)/1.2);
vig.addColorStop(0, 'rgba(255, 255, 255, 1)');
vig.addColorStop(1, 'rgba(40, 0, 0, 1)');
ctx.fillStyle = vig;
ctx.fillRect(0, 0, w, h);
}
// Reset blending mode just in case
ctx.globalCompositeOperation = "source-over";
return canvas;
}
Apply Changes