You can edit the below JavaScript code to customize the image tool.
Apply Changes
function processImage(originalImg, text = "Принцесса Соня", textSizeRel = 0.1, tintColor = "rgba(255, 182, 193, 0.4)", borderColor = "#ff69b4") {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
// Maintain original dimensions
canvas.width = originalImg.width;
canvas.height = originalImg.height;
// 1. Draw the original image
ctx.drawImage(originalImg, 0, 0);
// 2. Apply a "Princess" pink soft overlay
ctx.fillStyle = tintColor;
ctx.fillRect(0, 0, canvas.width, canvas.height);
// 3. Draw a cute, thick frame around the image
const borderW = Math.max(8, canvas.width * 0.03);
ctx.strokeStyle = borderColor;
ctx.lineWidth = borderW;
ctx.strokeRect(borderW / 2, borderW / 2, canvas.width - borderW, canvas.height - borderW);
// 4. Add Crown and Magical Sparkle Decorations using Emoji
const crownSize = Math.floor(Math.min(canvas.width, canvas.height) * 0.25);
ctx.font = `${crownSize}px Arial, sans-serif`;
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
// Draw Crown at Top Center
ctx.fillText("👑", canvas.width / 2, borderW + 10);
const sparkSize = Math.floor(Math.min(canvas.width, canvas.height) * 0.12);
ctx.font = `${sparkSize}px Arial, sans-serif`;
ctx.textBaseline = 'middle';
const offset = borderW + sparkSize * 0.6;
// Top corners sparkles
ctx.fillText("✨", offset, offset);
ctx.fillText("✨", canvas.width - offset, offset);
// Bottom corners hearts
const bottomOffset = canvas.height - offset;
ctx.fillText("💖", offset, bottomOffset);
ctx.fillText("💖", canvas.width - offset, bottomOffset);
// 5. Render "Princess Sonya" (or custom text) at the bottom
const fSize = Math.max(16, canvas.height * textSizeRel);
ctx.font = `bold ${fSize}px "Comic Sans MS", "Arial Rounded MT Bold", cursive, sans-serif`;
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
const textX = canvas.width / 2;
const textY = canvas.height - borderW - 20;
// Draw text with a pretty thick outline to make it pop
ctx.lineJoin = 'round';
ctx.lineWidth = Math.max(3, fSize * 0.2);
ctx.strokeStyle = borderColor; // Hot pink outline
ctx.strokeText(text, textX, textY);
ctx.fillStyle = '#ffffff'; // White text core
ctx.fillText(text, textX, textY);
return canvas;
}
Apply Changes