You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, hueAmount = "90", contrastAmount = "200", saturateAmount = "200", mirrorMode = "0", noiseAmount = "15", scanlineIntensity = "0.2") {
const canvas = document.createElement('canvas');
const w = originalImg.width;
const h = originalImg.height;
canvas.width = w;
canvas.height = h;
const ctx = canvas.getContext('2d', { willReadFrequently: true });
// "G-Major" YTP (YouTube Poop) visual effects typically heavily rely on
// color inversion, extreme hue shifts (usually to harsh reds/blues), and aggressive contrast.
ctx.filter = `invert(100%) hue-rotate(${hueAmount}deg) contrast(${contrastAmount}%) saturate(${saturateAmount}%)`;
// Apply mirroring, another common trope for extreme G-Major meme generators
const mirror = parseInt(mirrorMode, 10);
if (mirror === 1) {
// Mirror Left to Right
ctx.drawImage(originalImg, 0, 0, w / 2, h, 0, 0, w / 2, h);
ctx.save();
ctx.scale(-1, 1);
ctx.drawImage(originalImg, 0, 0, w / 2, h, -w, 0, w / 2, h);
ctx.restore();
} else if (mirror === 2) {
// Mirror Right to Left
ctx.drawImage(originalImg, w / 2, 0, w / 2, h, w / 2, 0, w / 2, h);
ctx.save();
ctx.scale(-1, 1);
ctx.drawImage(originalImg, w / 2, 0, w / 2, h, -w / 2, 0, w / 2, h);
ctx.restore();
} else {
// Standard full image
ctx.drawImage(originalImg, 0, 0);
}
// Reset filter before manipulating raw pixels or drawing standard shapes
ctx.filter = 'none';
// Apply visual noise to emulate the "cursed / degraded video" feel
const noise = parseFloat(noiseAmount);
if (noise > 0) {
const imgData = ctx.getImageData(0, 0, w, h);
const data = imgData.data;
for (let i = 0; i < data.length; i += 4) {
const noiseVal = (Math.random() - 0.5) * 2 * noise;
// Add noise to R, G, B channels, clamping values between 0 and 255
data[i] = Math.min(255, Math.max(0, data[i] + noiseVal));
data[i + 1] = Math.min(255, Math.max(0, data[i + 1] + noiseVal));
data[i + 2] = Math.min(255, Math.max(0, data[i + 2] + noiseVal));
}
ctx.putImageData(imgData, 0, 0);
}
// Draw scanlines to complete the retro distortion effect
const scanlines = parseFloat(scanlineIntensity);
if (scanlines > 0) {
ctx.fillStyle = `rgba(0, 0, 0, ${scanlines})`;
for (let y = 0; y < h; y += 4) {
ctx.fillRect(0, y, w, 2);
}
}
return canvas;
}
Apply Changes