You can edit the below JavaScript code to customize the image tool.
Apply Changes
async function processImage(originalImg, titleText = "КОМПАНИЯ ГОДА", yearText = "2024", themeColor = "#FFD700") {
// Create a square canvas commonly used for studio projects / social media profiles
const canvas = document.createElement('canvas');
canvas.width = 1080;
canvas.height = 1080;
const ctx = canvas.getContext('2d');
// Calculate scaling to cover the whole canvas (object-fit: cover equivalent)
const scale = Math.max(canvas.width / originalImg.width, canvas.height / originalImg.height);
const scaledWidth = originalImg.width * scale;
const scaledHeight = originalImg.height * scale;
const x = (canvas.width / 2) - (scaledWidth / 2);
const y = (canvas.height / 2) - (scaledHeight / 2);
// Draw the original image as the background
ctx.drawImage(originalImg, x, y, scaledWidth, scaledHeight);
// Apply a subtle dark vignette/gradient at the bottom for text readability
const bottomGradient = ctx.createLinearGradient(0, canvas.height - 400, 0, canvas.height);
bottomGradient.addColorStop(0, 'rgba(0,0,0,0)');
bottomGradient.addColorStop(1, 'rgba(0, 0, 0, 0.85)');
ctx.fillStyle = bottomGradient;
ctx.fillRect(0, canvas.height - 400, canvas.width, 400);
// Apply a subtle dark gradient at the top as well
const topGradient = ctx.createLinearGradient(0, 0, 0, 200);
topGradient.addColorStop(0, 'rgba(0, 0, 0, 0.5)');
topGradient.addColorStop(1, 'rgba(0,0,0,0)');
ctx.fillStyle = topGradient;
ctx.fillRect(0, 0, canvas.width, 200);
// Draw an elegant double border frame to represent an award/studio project
ctx.strokeStyle = themeColor;
// Outer thick border
ctx.lineWidth = 15;
ctx.strokeRect(40, 40, canvas.width - 80, canvas.height - 80);
// Inner thin border
ctx.lineWidth = 4;
ctx.strokeRect(70, 70, canvas.width - 140, canvas.height - 140);
// Decorative corners
const cornerSize = 40;
ctx.fillStyle = themeColor;
// Top-Left
ctx.fillRect(40, 40, cornerSize, cornerSize);
// Top-Right
ctx.fillRect(canvas.width - 40 - cornerSize, 40, cornerSize, cornerSize);
// Bottom-Left
ctx.fillRect(40, canvas.height - 40 - cornerSize, cornerSize, cornerSize);
// Bottom-Right
ctx.fillRect(canvas.width - 40 - cornerSize, canvas.height - 40 - cornerSize, cornerSize, cornerSize);
// Draw the "Company of the Year" main title text
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
// Title Text styling
ctx.fillStyle = themeColor;
ctx.font = 'bold 80px "Times New Roman", Times, Georgia, serif';
ctx.shadowColor = 'rgba(0, 0, 0, 0.8)';
ctx.shadowBlur = 10;
ctx.shadowOffsetX = 2;
ctx.shadowOffsetY = 2;
ctx.fillText(titleText.toUpperCase(), canvas.width / 2, canvas.height - 180);
// Year or Subtitle styling
ctx.fillStyle = '#FFFFFF';
ctx.font = 'bold 50px "Times New Roman", Times, Georgia, serif';
ctx.shadowBlur = 8;
ctx.fillText(`— ${yearText} —`, canvas.width / 2, canvas.height - 100);
// Reset shadow for further drawing if needed
ctx.shadowColor = 'transparent';
ctx.shadowBlur = 0;
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
// Add a top small label
ctx.fillStyle = themeColor;
ctx.font = 'italic 30px "Times New Roman", Times, Georgia, serif';
ctx.fillText("Studio Project", canvas.width / 2, 110);
return canvas;
}
Apply Changes