You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, subtitleText = "Language Dub Translator Download Text By", platformName = "Video Platform Audio Track") {
const canvas = document.createElement('canvas');
canvas.width = originalImg.width;
canvas.height = originalImg.height;
const ctx = canvas.getContext('2d');
// Draw the original image as the background (video frame)
ctx.drawImage(originalImg, 0, 0);
// Calculate proportional sizes based on image dimensions
const minDim = Math.min(canvas.width, canvas.height);
const fontSize = Math.max(16, minDim * 0.05);
// Draw top bar for the platform/audio track info
ctx.fillStyle = 'rgba(0, 0, 0, 0.6)';
ctx.fillRect(0, 0, canvas.width, fontSize * 2.5);
ctx.font = `${fontSize * 0.8}px Arial, sans-serif`;
ctx.textAlign = 'left';
ctx.textBaseline = 'middle';
ctx.fillStyle = 'white';
ctx.fillText(platformName, fontSize * 0.5, fontSize * 1.25);
// Draw a mock video player play button in the center
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
const buttonRadius = minDim * 0.1;
ctx.fillStyle = 'rgba(0, 0, 0, 0.6)';
ctx.beginPath();
ctx.arc(centerX, centerY, buttonRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.fillStyle = 'rgba(255, 255, 255, 0.9)';
ctx.beginPath();
const triSize = buttonRadius * 0.5;
ctx.moveTo(centerX - triSize * 0.5, centerY - triSize);
ctx.lineTo(centerX + triSize, centerY);
ctx.lineTo(centerX - triSize * 0.5, centerY + triSize);
ctx.closePath();
ctx.fill();
// Draw bottom bar for the player UI
ctx.fillStyle = 'rgba(0, 0, 0, 0.5)';
ctx.fillRect(0, canvas.height - fontSize * 3, canvas.width, fontSize * 3);
// Draw a fake progress bar
ctx.fillStyle = 'rgba(255, 255, 255, 0.3)';
ctx.fillRect(fontSize * 0.5, canvas.height - fontSize * 2, canvas.width - fontSize, fontSize * 0.2);
ctx.fillStyle = '#ff0000';
ctx.fillRect(fontSize * 0.5, canvas.height - fontSize * 2, (canvas.width - fontSize) * 0.35, fontSize * 0.2); // 35% progress
// Draw subtitle/dubbing text
ctx.font = `bold ${fontSize}px Arial, sans-serif`;
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
const subtitleY = canvas.height - fontSize * 3.5;
// Stroke (outline) for subtitle readability
ctx.lineWidth = Math.max(1, fontSize * 0.15);
ctx.strokeStyle = 'black';
ctx.strokeText(subtitleText, canvas.width / 2, subtitleY);
// Fill text for subtitle
ctx.fillStyle = 'yellow';
ctx.fillText(subtitleText, canvas.width / 2, subtitleY);
return canvas;
}
Apply Changes