You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, hueRotateDeg = 140, saturatePercent = 300, contrastPercent = 150, invertPercent = 100, mirrorMode = "none") {
const canvas = document.createElement('canvas');
const width = originalImg.width;
const height = originalImg.height;
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext('2d');
// Apply classic "G-Major 3" visual style (heavy inversion, hue-shift, and contrast boost)
ctx.filter = `invert(${invertPercent}%) hue-rotate(${hueRotateDeg}deg) saturate(${saturatePercent}%) contrast(${contrastPercent}%)`;
const halfWidth = width / 2;
const halfHeight = height / 2;
// A common staple of this YTP meme is mirroring the footage. Apply based on selected mode.
if (mirrorMode === "left") {
// Draw the left half normally
ctx.drawImage(originalImg, 0, 0, halfWidth, height, 0, 0, halfWidth, height);
// Mirror the left half onto the right side
ctx.save();
ctx.translate(width, 0);
ctx.scale(-1, 1);
ctx.drawImage(originalImg, 0, 0, halfWidth, height, 0, 0, halfWidth, height);
ctx.restore();
}
else if (mirrorMode === "right") {
// Draw the right half normally
ctx.drawImage(originalImg, halfWidth, 0, halfWidth, height, halfWidth, 0, halfWidth, height);
// Mirror the right half onto the left side
ctx.save();
ctx.translate(width, 0);
ctx.scale(-1, 1);
ctx.drawImage(originalImg, halfWidth, 0, halfWidth, height, halfWidth, 0, halfWidth, height);
ctx.restore();
}
else if (mirrorMode === "top") {
// Draw the top half normally
ctx.drawImage(originalImg, 0, 0, width, halfHeight, 0, 0, width, halfHeight);
// Mirror the top half down
ctx.save();
ctx.translate(0, height);
ctx.scale(1, -1);
ctx.drawImage(originalImg, 0, 0, width, halfHeight, 0, 0, width, halfHeight);
ctx.restore();
}
else if (mirrorMode === "bottom") {
// Draw the bottom half normally
ctx.drawImage(originalImg, 0, halfHeight, width, halfHeight, 0, halfHeight, width, halfHeight);
// Mirror the bottom half up
ctx.save();
ctx.translate(0, height);
ctx.scale(1, -1);
ctx.drawImage(originalImg, 0, halfHeight, width, halfHeight, 0, halfHeight, width, halfHeight);
ctx.restore();
}
else {
// By default ("none"), just draw the full filtered image
ctx.drawImage(originalImg, 0, 0, width, height);
}
return canvas;
}
Apply Changes