You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, searchTitle = "Gahlina Pintadinha Movie") {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
// Layout configuration
const width = 800;
const margin = 20;
const maxImgWidth = width - margin * 2;
// Calculate aspect ratio and dimensions, capping height to max 600px to maintain a reasonable UI
let imgWidth = maxImgWidth;
let imgHeight = originalImg.height * (imgWidth / originalImg.width);
if (imgHeight > 600) {
imgHeight = 600;
imgWidth = originalImg.width * (imgHeight / originalImg.height);
}
const headerHeight = 70;
const titleHeight = 90;
const height = headerHeight + margin + imgHeight + titleHeight + margin;
canvas.width = width;
canvas.height = height;
// 1. Draw Page Background
ctx.fillStyle = "#F5F5F5";
ctx.fillRect(0, 0, width, height);
// 2. Draw Header Bar (Galinha Pintadinha Signature Blue)
ctx.fillStyle = "#1E90FF";
ctx.fillRect(0, 0, width, headerHeight);
// 3. Draw Brand Logo/Icon (Chicken theme: red crest, yellow beak)
ctx.fillStyle = "#FF0000"; // Red crest
ctx.beginPath();
ctx.arc(margin + 15, headerHeight / 2 - 6, 8, 0, Math.PI * 2);
ctx.arc(margin + 26, headerHeight / 2 - 8, 10, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = "#FFD700"; // Yellow beak/body
ctx.beginPath();
ctx.moveTo(margin + 20, headerHeight / 2 + 5);
ctx.lineTo(margin + 30, headerHeight / 2 + 16);
ctx.lineTo(margin + 10, headerHeight / 2 + 16);
ctx.fill();
// App Name
ctx.fillStyle = "white";
ctx.font = "bold 24px sans-serif";
ctx.textAlign = "left";
ctx.textBaseline = "middle";
ctx.fillText("VidSearch", margin + 45, headerHeight / 2);
// 4. Draw Search Bar
const searchBoxWidth = 450;
const searchBoxX = (width - searchBoxWidth) / 2;
const searchBoxY = 15;
const searchBoxHeight = 40;
const radius = 20;
ctx.fillStyle = "white";
ctx.beginPath();
ctx.moveTo(searchBoxX + radius, searchBoxY);
ctx.lineTo(searchBoxX + searchBoxWidth - radius, searchBoxY);
ctx.quadraticCurveTo(searchBoxX + searchBoxWidth, searchBoxY, searchBoxX + searchBoxWidth, searchBoxY + radius);
ctx.lineTo(searchBoxX + searchBoxWidth, searchBoxY + searchBoxHeight - radius);
ctx.quadraticCurveTo(searchBoxX + searchBoxWidth, searchBoxY + searchBoxHeight, searchBoxX + searchBoxWidth - radius, searchBoxY + searchBoxHeight);
ctx.lineTo(searchBoxX + radius, searchBoxY + searchBoxHeight);
ctx.quadraticCurveTo(searchBoxX, searchBoxY + searchBoxHeight, searchBoxX, searchBoxY + searchBoxHeight - radius);
ctx.lineTo(searchBoxX, searchBoxY + radius);
ctx.quadraticCurveTo(searchBoxX, searchBoxY, searchBoxX + radius, searchBoxY);
ctx.closePath();
ctx.fill();
// Search Text
ctx.font = "16px sans-serif";
ctx.fillStyle = "#222";
let displayText = searchTitle.length > 40 ? searchTitle.substring(0, 37) + '...' : searchTitle;
ctx.fillText(displayText, searchBoxX + 20, searchBoxY + searchBoxHeight / 2);
// Search Icon (Magnifying Glass)
ctx.strokeStyle = "#888";
ctx.lineWidth = 2;
ctx.beginPath();
ctx.arc(searchBoxX + searchBoxWidth - 30, searchBoxY + 18, 6, 0, Math.PI * 2);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(searchBoxX + searchBoxWidth - 25, searchBoxY + 23);
ctx.lineTo(searchBoxX + searchBoxWidth - 15, searchBoxY + 32);
ctx.stroke();
// 5. Draw Image Result Thumbnail
const imgX = backgroundCenteredX = margin + (maxImgWidth - imgWidth) / 2;
const imgY = headerHeight + margin;
// Draw white background behind image (useful for rendering transparent PNGs nicely)
ctx.fillStyle = "white";
ctx.shadowColor = "rgba(0,0,0,0.15)";
ctx.shadowBlur = 10;
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 4;
ctx.fillRect(imgX, imgY, imgWidth, imgHeight);
// Draw actual image inside bounds
ctx.shadowColor = "transparent"; // Reset shadow for the image drawing
ctx.drawImage(originalImg, imgX, imgY, imgWidth, imgHeight);
// 6. Draw Play Button Overlay (YouTube/Netflix style)
const playRadius = 45;
const playX = imgX + imgWidth / 2;
const playY = imgY + imgHeight / 2;
ctx.fillStyle = "rgba(0, 0, 0, 0.65)";
ctx.beginPath();
ctx.arc(playX, playY, playRadius, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = "white";
ctx.beginPath();
ctx.moveTo(playX - 12, playY - 18);
ctx.lineTo(playX + 18, playY);
ctx.lineTo(playX - 12, playY + 18);
ctx.closePath();
ctx.fill();
// 7. Video Progress Bar (Mocked watch progress)
ctx.fillStyle = "#FF0000"; // Red watched portion
ctx.fillRect(imgX, imgY + imgHeight - 6, imgWidth * 0.45, 6);
ctx.fillStyle = "rgba(255, 255, 255, 0.6)"; // White unwatched portion
ctx.fillRect(imgX + imgWidth * 0.45, imgY + imgHeight - 6, imgWidth * 0.55, 6);
// 8. Result Details & Text
ctx.font = "bold 22px sans-serif";
ctx.fillStyle = "#111";
ctx.textAlign = "left";
ctx.textBaseline = "top";
ctx.fillText(`${searchTitle.trim()} - HD Full Episode Search Match`, imgX, imgY + imgHeight + 20);
ctx.font = "16px sans-serif";
ctx.fillStyle = "#606060";
ctx.fillText("Galinha Pintadinha Oficial \u2022 42.8M views \u2022 1 year ago", imgX, imgY + imgHeight + 48);
ctx.fillStyle = "white";
ctx.font = "12px sans-serif";
const tagBgWidth = 90;
const tagYOffset = 46;
ctx.fillStyle = "#0f0f0f";
ctx.fillRect(imgX + imgWidth - tagBgWidth, imgY + imgHeight + tagYOffset, tagBgWidth, 22);
ctx.fillStyle = "white";
ctx.textAlign = "center";
ctx.fillText("Subtitles (CC)", imgX + imgWidth - tagBgWidth / 2, imgY + imgHeight + tagYOffset + 4);
return canvas;
}
Apply Changes