You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, movieTitle = 'Кино Загрузка', subtitleText = 'Ожидание автодубляжа и перевода...', language = 'RU', addTvEffect = 1) {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const width = originalImg.width;
const height = originalImg.height;
// Maintain dimensions of the original image
canvas.width = width;
canvas.height = height;
// Draw the original image to canvas
ctx.drawImage(originalImg, 0, 0, width, height);
// Apply Television CRT Effect (Scanlines and Vignette) if enabled
if (Number(addTvEffect) === 1) {
ctx.fillStyle = 'rgba(0, 0, 0, 0.15)';
for (let i = 0; i < height; i += 4) {
ctx.fillRect(0, i, width, 1);
}
// Vignette effect for that cinematic/TV look
const gradient = ctx.createRadialGradient(width / 2, height / 2, height / 3, width / 2, height / 2, Math.max(width, height) / 1.1);
gradient.addColorStop(0, 'rgba(0,0,0,0)');
gradient.addColorStop(1, 'rgba(0,0,0,0.7)');
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, width, height);
}
// Determine layout unit sizes based on image dimensions
const padding = Math.max(15, width * 0.03);
const fontSizeBase = Math.max(16, height * 0.05);
// Setup top dark gradient for UI header visibility
const topGradientHeight = fontSizeBase * 3;
const topGradient = ctx.createLinearGradient(0, 0, 0, topGradientHeight);
topGradient.addColorStop(0, 'rgba(0,0,0,0.85)');
topGradient.addColorStop(1, 'rgba(0,0,0,0)');
ctx.fillStyle = topGradient;
ctx.fillRect(0, 0, width, topGradientHeight);
// Setup bottom dark gradient for Subtitles and Player Controls
const bottomGradientHeight = fontSizeBase * 5;
const bottomGradient = ctx.createLinearGradient(0, height - bottomGradientHeight, 0, height);
bottomGradient.addColorStop(0, 'rgba(0,0,0,0)');
bottomGradient.addColorStop(1, 'rgba(0,0,0,0.9)');
ctx.fillStyle = bottomGradient;
ctx.fillRect(0, height - bottomGradientHeight, width, bottomGradientHeight);
// Text generic shadow
ctx.shadowColor = 'rgba(0, 0, 0, 0.8)';
ctx.shadowBlur = 4;
ctx.shadowOffsetX = 2;
ctx.shadowOffsetY = 2;
// Draw Movie Title (Top Left)
ctx.font = `bold ${fontSizeBase * 0.8}px sans-serif`;
ctx.fillStyle = 'white';
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
ctx.fillText(movieTitle || 'Unknown Movie', padding, padding);
// Draw Languages of the World / Auto-Dubbing Badge (Top Right)
const badgeText = `Телевизоры | Автодубляж (${language})`;
ctx.textAlign = 'right';
ctx.fillStyle = '#4ade80';
ctx.fillText(badgeText, width - padding, padding);
// Reset shadow for clearer stroke elements
ctx.shadowColor = 'transparent';
// Draw Dubbing Translation / Subtitles (Bottom Center)
ctx.font = `bold ${fontSizeBase * 1.1}px sans-serif`;
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
const subY = height - bottomGradientHeight * 0.45;
ctx.lineJoin = "round";
ctx.miterLimit = 2;
ctx.lineWidth = fontSizeBase * 0.2;
ctx.strokeStyle = 'black';
// Draw subtitle outline
ctx.strokeText(subtitleText, width / 2, subY);
// Draw subtitle text
ctx.fillStyle = '#ffde00'; // Classic yellow translation style
ctx.fillText(subtitleText, width / 2, subY);
// Draw Disc Player UI elements
const barY = height - padding;
const playBtnSize = fontSizeBase * 0.6;
// Play button
ctx.fillStyle = 'white';
ctx.beginPath();
ctx.moveTo(padding, barY - playBtnSize);
ctx.lineTo(padding, barY + playBtnSize);
ctx.lineTo(padding + playBtnSize * 1.5, barY);
ctx.closePath();
ctx.fill();
// Time representation
ctx.font = `${fontSizeBase * 0.45}px monospace`;
ctx.textAlign = 'right';
ctx.textBaseline = 'middle';
ctx.fillStyle = 'white';
const timeText = '01:24:05 / 02:15:30';
ctx.fillText(timeText, width - padding, barY);
const timeWidth = ctx.measureText(timeText).width;
// Timeline Progress bar
const barStartX = padding + playBtnSize * 2.5;
const barEndX = width - padding - timeWidth - padding;
const barWidth = barEndX - barStartX;
if (barWidth > 0) {
// Track background
ctx.fillStyle = 'rgba(255, 255, 255, 0.3)';
ctx.beginPath();
if (ctx.roundRect) ctx.roundRect(barStartX, barY - 2, barWidth, 4, 3);
else ctx.rect(barStartX, barY - 2, barWidth, 4);
ctx.fill();
// Current Progress Indicator
const progressAmount = barWidth * 0.62; // 62% played
ctx.fillStyle = '#e50914';
ctx.beginPath();
if (ctx.roundRect) ctx.roundRect(barStartX, barY - 2, progressAmount, 4, 3);
else ctx.rect(barStartX, barY - 2, progressAmount, 4);
ctx.fill();
// Timeline handle
ctx.beginPath();
ctx.arc(barStartX + progressAmount, barY, Math.max(4, fontSizeBase * 0.15), 0, Math.PI * 2);
ctx.fillStyle = '#e50914';
ctx.fill();
}
// Disc Loading Indicator / Download UI
const discRadius = fontSizeBase * 0.35;
const discX = width - padding - discRadius;
const discY = barY - discRadius * 3.5;
ctx.beginPath();
ctx.arc(discX, discY, discRadius, 0, Math.PI * 2);
ctx.strokeStyle = 'rgba(255, 255, 255, 0.2)';
ctx.lineWidth = 3;
ctx.stroke();
ctx.beginPath();
// Simulate spinning loading portion
ctx.arc(discX, discY, discRadius, -Math.PI / 2, Math.PI / 1.5);
ctx.strokeStyle = '#3b82f6';
ctx.stroke();
ctx.font = `${fontSizeBase * 0.4}px sans-serif`;
ctx.textAlign = 'right';
ctx.fillStyle = '#9ca3af';
ctx.fillText('ЗАГРУЗКА ДИСК ПЛЕЕР...', discX - discRadius * 2, discY);
return canvas;
}
Apply Changes