You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, queryText = "September 2026", highlightColor = "#F74C14") {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
// Set fixed output dimensions for a clean, app-like UI graphic
const width = 800;
const height = 750;
canvas.width = width;
canvas.height = height;
// Fill deep dark background (typical streaming app style)
ctx.fillStyle = '#121212';
ctx.fillRect(0, 0, width, height);
// Utility function for drawing rounded rectangles
function fillRoundRect(x, y, w, h, r) {
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.lineTo(x + w - r, y);
ctx.quadraticCurveTo(x + w, y, x + w, y + r);
ctx.lineTo(x + w, y + h - r);
ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
ctx.lineTo(x + r, y + h);
ctx.quadraticCurveTo(x, y + h, x, y + h - r);
ctx.lineTo(x, y + r);
ctx.quadraticCurveTo(x, y, x + r, y);
ctx.closePath();
ctx.fill();
}
// 1. Draw "Hero Banner" Image (Cinematic 16:9 / 2:1 style crop)
const bannerHeight = 400;
const srcRatio = originalImg.width / originalImg.height;
const targetRatio = width / bannerHeight;
let sWidth = originalImg.width;
let sHeight = originalImg.height;
let sx = 0, sy = 0;
// Scale and center crop to fit banner dimensions
if (srcRatio > targetRatio) {
sWidth = originalImg.height * targetRatio;
sx = (originalImg.width - sWidth) / 2;
} else {
sHeight = originalImg.width / targetRatio;
sy = (originalImg.height - sHeight) / 2;
}
ctx.drawImage(originalImg, sx, sy, sWidth, sHeight, 0, 0, width, bannerHeight);
// Add vertical fade-out gradient blending the banner into the background
const grad = ctx.createLinearGradient(0, bannerHeight - 150, 0, bannerHeight);
grad.addColorStop(0, 'rgba(18,18,18,0)');
grad.addColorStop(1, 'rgba(18,18,18,1)');
ctx.fillStyle = grad;
ctx.fillRect(0, bannerHeight - 150, width, 150);
// 2. Header UI Overlay (Simulating app navigation)
const headerH = 60;
ctx.fillStyle = 'rgba(0, 0, 0, 0.7)';
ctx.fillRect(0, 0, width, headerH);
// Fake Tubi-style Logo
ctx.font = 'italic 900 32px "Trebuchet MS", Arial, sans-serif';
ctx.fillStyle = highlightColor;
ctx.textBaseline = 'middle';
ctx.fillText('tubi', 24, headerH / 2);
// Fake Search Input Bar
const sbW = 320, sbH = 34, sbX = width - sbW - 24, sbY = (headerH - sbH) / 2;
ctx.fillStyle = 'rgba(255, 255, 255, 0.1)';
fillRoundRect(sbX, sbY, sbW, sbH, 17);
ctx.fillStyle = '#cccccc';
ctx.font = '14px Arial, sans-serif';
// Append the search parameter to the fake input box
ctx.fillText('🔍 Search results for "' + queryText + '"', sbX + 16, headerH / 2);
// 3. Central Play Button on the Hero Banner
const cx = width / 2;
const cy = bannerHeight / 2;
ctx.fillStyle = 'rgba(247, 76, 20, 0.9)'; // Use theme color with slight transparency
ctx.beginPath();
ctx.arc(cx, cy, 40, 0, Math.PI * 2);
ctx.fill();
// Play Triangle
ctx.fillStyle = '#ffffff';
ctx.beginPath();
ctx.moveTo(cx - 10, cy - 14);
ctx.lineTo(cx + 16, cy);
ctx.lineTo(cx - 10, cy + 14);
ctx.fill();
// 4. Movie / Search Result Information
const infoY = bannerHeight + 20;
ctx.fillStyle = '#46d369';
ctx.font = 'bold 16px Arial, sans-serif';
ctx.fillText('99% Match', 30, infoY);
ctx.fillStyle = '#ffffff';
ctx.font = 'bold 36px Arial, sans-serif';
ctx.fillText('Analyzed Image Match', 30, infoY + 40);
ctx.fillStyle = '#aaaaaa';
ctx.font = '14px Arial, sans-serif';
ctx.fillText('Sep 2026 • 1h 45m • TV-MA • HD', 30, infoY + 70);
ctx.fillStyle = '#dddddd';
ctx.font = '14px Arial, sans-serif';
ctx.fillText('Based on the visual analysis of your image, this represents a top trending movie matched in', 30, infoY + 100);
ctx.fillText('our September 2026 database index. Watch the AI match right now for free.', 30, infoY + 120);
// Watch Button
const btnW = 180, btnH = 44, btnX = 30, btnY = infoY + 150;
ctx.fillStyle = highlightColor;
fillRoundRect(btnX, btnY, btnW, btnH, 4);
ctx.fillStyle = '#ffffff';
ctx.font = 'bold 16px Arial, sans-serif';
ctx.textAlign = 'center';
ctx.fillText('Watch Now - Free', btnX + btnW / 2, btnY + btnH / 2);
ctx.textAlign = 'left';
// 5. "More Like This" Simulated Thumbnails Block
const moreY = btnY + 70;
ctx.fillStyle = '#ffffff';
ctx.font = 'bold 20px Arial, sans-serif';
ctx.fillText('More Releases from September 2026', 30, moreY);
const thumbW = 171;
const thumbH = 100;
const space = 18;
ctx.textAlign = 'center';
for (let i = 0; i < 4; i++) {
const tx = 30 + (thumbW + space) * i;
const ty = moreY + 20;
// Placeholder Thumbnail Background
ctx.fillStyle = '#1e1e1e';
fillRoundRect(tx, ty, thumbW, thumbH, 6);
ctx.fillStyle = '#555555';
ctx.font = 'bold 14px Arial, sans-serif';
ctx.fillText('Tubi Original', tx + thumbW/2, ty + thumbH/2 - 12);
ctx.font = '13px Arial, sans-serif';
ctx.fillText(`Sept '26 Hit #${i+1}`, tx + thumbW/2, ty + thumbH/2 + 12);
// Tiny Play Icon inside placeholder
ctx.fillStyle = 'rgba(255, 255, 255, 0.15)';
ctx.beginPath();
ctx.arc(tx + thumbW/2, ty + thumbH/2, 20, 0, Math.PI*2);
ctx.fill();
}
return canvas;
}
Apply Changes