Please bookmark this page to avoid losing your image tool!

Image Entomology Reference For Wandering Termites

(Free & Supports Bulk Upload)

Drag & drop your images here or

The result will appear here...
You can edit the below JavaScript code to customize the image tool.
function processImage(originalImg, commonName = "Бродячие термиты", scientificName = "Reticulitermes lucifugus", referenceNumber = "Cat. No. 734", scaleLength = 5, scaleUnit = "mm") {
    // 1. Define layout and dimensions
    const padding = {
        top: 70,
        bottom: 80,
        left: 40,
        right: 40
    };
    const canvasWidth = originalImg.width + padding.left + padding.right;
    const canvasHeight = originalImg.height + padding.top + padding.bottom;
    const fontFamily = 'Georgia, serif';

    // 2. Create canvas and get 2D context
    const canvas = document.createElement('canvas');
    canvas.width = canvasWidth;
    canvas.height = canvasHeight;
    const ctx = canvas.getContext('2d');

    // 3. Draw the background, creating a 'specimen card' look
    ctx.fillStyle = '#fdfdf6'; // Light parchment/off-white color
    ctx.fillRect(0, 0, canvasWidth, canvasHeight);
    ctx.strokeStyle = '#cccccc'; // Light gray border
    ctx.lineWidth = 1;
    ctx.strokeRect(0, 0, canvasWidth, canvasHeight);

    // 4. Draw the original image onto the canvas
    const imgX = padding.left;
    const imgY = padding.top;
    ctx.drawImage(originalImg, imgX, imgY, originalImg.width, originalImg.height);
    
    // Add a simple border around the image to frame it
    ctx.strokeStyle = 'rgba(0, 0, 0, 0.3)';
    ctx.lineWidth = 1;
    ctx.strokeRect(imgX, imgY, originalImg.width, originalImg.height);

    // 5. Add text labels
    ctx.fillStyle = '#222222'; // Dark color for text for readability
    
    // Title (Common Name)
    ctx.font = `bold 26px ${fontFamily}`;
    ctx.textAlign = 'center';
    ctx.fillText(commonName, canvasWidth / 2, 45);

    // Scientific Name (italicized)
    ctx.font = `italic 20px ${fontFamily}`;
    ctx.fillText(scientificName, canvasWidth / 2, canvasHeight - 50);

    // Reference Number (bottom-left)
    ctx.font = `14px ${fontFamily}`;
    ctx.textAlign = 'left';
    ctx.fillText(referenceNumber, padding.left, canvasHeight - 20);

    // 6. Draw a scale bar (bottom-right)
    const scaleBarWidthPx = 100; // The visual width of the scale bar in pixels
    const scaleBarHeight = 6;
    const scaleBarX = canvasWidth - padding.right - scaleBarWidthPx;
    const scaleBarY = canvasHeight - 20 - scaleBarHeight;
    
    // Draw the bar with alternating segments for a classic look
    const numSegments = 5;
    const segmentWidth = scaleBarWidthPx / numSegments;
    for (let i = 0; i < numSegments; i++) {
        ctx.fillStyle = (i % 2 === 0) ? '#222222' : '#fdfdf6';
        ctx.fillRect(scaleBarX + i * segmentWidth, scaleBarY, segmentWidth, scaleBarHeight);
    }
    
    // Outline the whole scale bar
    ctx.strokeStyle = '#222222';
    ctx.lineWidth = 1;
    ctx.strokeRect(scaleBarX, scaleBarY, scaleBarWidthPx, scaleBarHeight);

    // Label for the scale bar
    ctx.fillStyle = '#222222';
    ctx.textAlign = 'center';
    ctx.font = `14px ${fontFamily}`;
    ctx.fillText(`${scaleLength} ${scaleUnit}`, scaleBarX + scaleBarWidthPx / 2, scaleBarY - 8);

    // 7. Return the final 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!

Description

The ‘Image Entomology Reference for Wandering Termites’ tool allows users to create a visually appealing specimen card for wandering termites. By processing an original image of a termite, the tool adds essential labels, including the common name, scientific name, and reference number, while incorporating a scale bar for size reference. This tool is particularly useful for entomologists, educators, and researchers needing to present termite specimens in a professional format for studies, educational materials, or presentations.

Leave a Reply

Your email address will not be published. Required fields are marked *