You can edit the below JavaScript code to customize the image tool.
/**
* Generates a "soft program name" and overlays it onto the provided image.
* The function creates a random tech-sounding name or uses a custom one,
* then draws it on a canvas over the original image with customizable styling.
*
* @param {Image} originalImg The original JavaScript Image object.
* @param {string} [customText=""] A custom program name to use. If empty, a random name is generated.
* @param {string} [fontColor="#FFFFFF"] The color of the text (e.g., "#RRGGBB").
* @param {number} [fontSize=48] The initial font size in pixels. It will be auto-adjusted to fit the image width.
* @param {string} [fontFamily="Orbitron"] The Google Font family to use for the text.
* @param {string} [textPosition="center"] The position of the text. Can be "center", "top-center", or "bottom-center".
* @param {string} [backgroundColor="rgba(0, 0, 0, 0.5)"] The background color for the text box. Use "transparent" for no background.
* @param {number} [padding=20] The padding in pixels around the text for the background box.
* @returns {Promise<HTMLCanvasElement>} A promise that resolves to a canvas element with the image and text.
*/
async function processImage(originalImg, customText = "", fontColor = "#FFFFFF", fontSize = 48, fontFamily = "Orbitron", textPosition = "center", backgroundColor = "rgba(0, 0, 0, 0.5)", padding = 20) {
// Create a canvas element and get its 2D rendering context.
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
// Set canvas dimensions to match the original image's intrinsic size.
canvas.width = originalImg.naturalWidth;
canvas.height = originalImg.naturalHeight;
// Draw the original image onto the canvas.
ctx.drawImage(originalImg, 0, 0, canvas.width, canvas.height);
// Generate a random program name if no custom text is provided.
let programName = customText;
if (!programName) {
const prefixes = ['Quantum', 'Cyber', 'Aero', 'Stellar', 'Nexus', 'Echo', 'Vertex', 'Nova', 'Zenith', 'Orion', 'Pulsar', 'Helix', 'Omni', 'Synchro', 'Core', 'Data', 'Info', 'Tech', 'Net', 'Web'];
const suffixes = ['Flow', 'Sync', 'Base', 'Ware', 'Deck', 'Sphere', 'Gen', 'Grid', 'Byte', 'Logic', 'Cast', 'Shift', 'Point', 'Drive', 'Pulse', 'Soft', 'Matrix', 'Engine', 'Vortex', 'Bridge'];
const prefix = prefixes[Math.floor(Math.random() * prefixes.length)];
const suffix = suffixes[Math.floor(Math.random() * suffixes.length)];
programName = `${prefix}${suffix}`;
}
// Dynamically load the specified Google Font.
// This ensures the font is available before we try to use it for drawing.
const fontId = `google-font-${fontFamily.replace(/\s/g, '-')}`;
if (!document.getElementById(fontId)) {
const link = document.createElement('link');
link.id = fontId;
link.rel = 'stylesheet';
link.href = `https://fonts.googleapis.com/css2?family=${fontFamily.replace(/\s/g, '+')}&display=swap`;
document.head.appendChild(link);
}
// Wait for the font to be loaded and ready. Fallback to a safe font on error.
try {
await document.fonts.load(`10px ${fontFamily}`);
} catch (e) {
console.error(`Font '${fontFamily}' could not be loaded. Falling back to Arial.`, e);
fontFamily = "Arial"; // A web-safe fallback font.
}
// Adjust font size dynamically to ensure the text fits within the image width.
let currentFontSize = fontSize;
ctx.font = `${currentFontSize}px ${fontFamily}`;
const maxWidth = canvas.width - (padding * 2);
while (ctx.measureText(programName).width > maxWidth && currentFontSize > 10) {
currentFontSize--;
ctx.font = `${currentFontSize}px ${fontFamily}`;
}
// Set final text styles for drawing.
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
// Calculate text dimensions and position.
const textMetrics = ctx.measureText(programName);
const textWidth = textMetrics.width;
const textHeight = currentFontSize; // Use font size as a reliable approximation for height.
let x, y;
switch (textPosition) {
case 'top-center':
x = canvas.width / 2;
y = padding + textHeight / 2;
break;
case 'bottom-center':
x = canvas.width / 2;
y = canvas.height - (padding + textHeight / 2);
break;
case 'center':
default:
x = canvas.width / 2;
y = canvas.height / 2;
break;
}
// Draw a semi-transparent background box for better text readability.
if (backgroundColor && backgroundColor !== 'transparent') {
ctx.fillStyle = backgroundColor;
const rectX = x - textWidth / 2 - padding;
const rectY = y - textHeight / 2 - padding;
const rectWidth = textWidth + padding * 2;
const rectHeight = textHeight + padding * 2;
ctx.fillRect(rectX, rectY, rectWidth, rectHeight);
}
// Draw the final text on top of the image and background.
ctx.fillStyle = fontColor;
ctx.fillText(programName, x, y);
// Return the completed canvas element.
return canvas;
}
Free Image Tool Creator
Can't find the image tool you're looking for? Create one based on your own needs now!
The Image Soft Program Name Generator is a web-based tool that allows users to create visually appealing images by overlaying a custom or randomly generated tech-sounding program name onto their chosen images. Users can customize various aspects of the overlay including text color, font size, font family, text position, and background color. This tool is ideal for software developers, designers, and marketers looking to create branded graphics, promotional materials, or simply add a creative touch to their images in a fun and engaging way.