You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, effectIntensityStr = "100", variantNumberStr = "6272111", applyMirrorStr = "true") {
// Parse parameters
const intensity = Math.max(0, parseFloat(effectIntensityStr) / 100) || 1;
const variantId = parseInt(variantNumberStr, 10) || 6272111;
const applyMirror = applyMirrorStr.toLowerCase() === "true";
// Setup canvas
const canvas = document.createElement('canvas');
const width = originalImg.naturalWidth || originalImg.width;
const height = originalImg.naturalHeight || originalImg.height;
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext('2d');
// Calculate a hue rotation shift based on the variant number to give it a unique "Major" tint
const hueShift = variantId % 360;
// "Major" effect aesthetics typical to internet meme videos (high contrast, saturation, and hue shifting)
ctx.filter = `contrast(${100 + (150 * intensity)}%) saturate(${100 + (200 * intensity)}%) hue-rotate(${hueShift}deg)`;
if (applyMirror) {
// Classic "Major" kaleidoscope / mirror effect (mirrors left half onto the right half)
const halfWidth = Math.floor(width / 2);
// Draw normal left half
ctx.drawImage(originalImg, 0, 0, halfWidth, height, 0, 0, halfWidth, height);
ctx.save();
ctx.scale(-1, 1);
// Draw flipped left half onto the right side
ctx.drawImage(originalImg, 0, 0, halfWidth, height, -width, 0, halfWidth, height);
ctx.restore();
} else {
// Draw normally if mirror is disabled
ctx.drawImage(originalImg, 0, 0, width, height);
}
// Reset filter for overlays
ctx.filter = 'none';
// Apply "Germanyball" Tricolor Overlay (Black, Red, Gold)
ctx.globalCompositeOperation = 'overlay';
ctx.globalAlpha = 0.8 * intensity;
// Create sharp horizontal tricolor gradient
const gradient = ctx.createLinearGradient(0, 0, 0, height);
const germanBlack = '#000000';
const germanRed = '#FF0000';
const germanGold = '#FFCC00';
gradient.addColorStop(0, germanBlack);
gradient.addColorStop(0.33, germanBlack);
gradient.addColorStop(0.33, germanRed);
gradient.addColorStop(0.66, germanRed);
gradient.addColorStop(0.66, germanGold);
gradient.addColorStop(1, germanGold);
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, width, height);
// Reset context
ctx.globalCompositeOperation = 'source-over';
// Add "Major" creepy/TV aesthetic scanlines
ctx.globalAlpha = 0.15 * intensity;
for (let y = 0; y < height; y += 4) {
ctx.fillStyle = '#000000';
ctx.fillRect(0, y, width, 2);
}
// Final reset
ctx.globalAlpha = 1.0;
return canvas;
}
Apply Changes