You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(
originalImg,
title = "Ice Age (2002) - Nogai Dub Cast",
castList = "Манфред (Manny): Local Voice Actor, Сид (Sid): Local Voice Actor, Диего (Diego): Local Voice Actor, Скрат (Scrat): Local Voice Actor, Рошан (Roshan): Local Voice Actor",
overlayOpacity = 0.75,
titleColor = "#00d2ff",
textColor = "#ffffff"
) {
// Create a new canvas to draw the tool's output
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
// Match the canvas dimensions to the original image
canvas.width = originalImg.width;
canvas.height = originalImg.height;
// 1. Draw the original image as a background
ctx.drawImage(originalImg, 0, 0);
// 2. Apply a dark, semi-transparent gradient overlay to ensure text legibility
const gradient = ctx.createLinearGradient(0, 0, 0, canvas.height);
gradient.addColorStop(0, `rgba(0, 0, 0, ${Number(overlayOpacity) + 0.1})`);
gradient.addColorStop(0.5, `rgba(0, 0, 0, ${Number(overlayOpacity)})`);
gradient.addColorStop(1, `rgba(0, 0, 0, ${Number(overlayOpacity) + 0.15})`);
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Calculate dynamic scaling for typography based on image size
const minDim = Math.min(canvas.width, canvas.height);
const titleFontSize = Math.max(26, minDim * 0.07);
const castFontSize = Math.max(18, minDim * 0.045);
// Apply basic text shadow for cinematic pop
ctx.shadowColor = '#000000';
ctx.shadowBlur = 8;
ctx.shadowOffsetX = 2;
ctx.shadowOffsetY = 2;
// 3. Render the Title
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = `bold ${titleFontSize}px 'Trebuchet MS', 'Impact', sans-serif`;
ctx.fillStyle = titleColor;
const titleY = canvas.height * 0.12;
ctx.fillText(title, canvas.width / 2, titleY);
// 4. Render the Cast Information line by line
ctx.font = `${castFontSize}px 'Trebuchet MS', Arial, sans-serif`;
ctx.fillStyle = textColor;
// The castList is passed as a string separated by commas.
// We split it to draw each cast member on a new line.
const roles = castList.split(',').map(s => s.trim());
let currentY = titleY + titleFontSize + (minDim * 0.1);
const lineSpacing = castFontSize * 1.6;
roles.forEach(role => {
// Draw the text
ctx.fillText(role, canvas.width / 2, currentY);
// Add a subtle underline separator between cast members
ctx.save();
ctx.shadowColor = 'transparent';
ctx.strokeStyle = 'rgba(255, 255, 255, 0.2)';
ctx.lineWidth = 1;
const textWidth = ctx.measureText(role).width;
ctx.beginPath();
ctx.moveTo((canvas.width / 2) - (textWidth / 2) + 10, currentY + castFontSize + 4);
ctx.lineTo((canvas.width / 2) + (textWidth / 2) - 10, currentY + castFontSize + 4);
ctx.stroke();
ctx.restore();
currentY += lineSpacing;
});
// 5. Add a footer label
const footerFontSize = Math.max(12, minDim * 0.025);
ctx.font = `italic ${footerFontSize}px 'Trebuchet MS', Arial, sans-serif`;
ctx.fillStyle = "rgba(255, 255, 255, 0.5)";
ctx.fillText("Nogai Dub Cast Information Card", canvas.width / 2, canvas.height - (minDim * 0.05));
return canvas;
}
Apply Changes