Please bookmark this page to avoid losing your image tool!

Image Of The Case Of Gribnica

(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.
async function processImage(originalImg, caseNumber = '731-БИС', stampText = 'СОВ. СЕКРЕТНО', sepia = 1.0, noise = 0.15, textColor = '#1a1a1a', stampColor = '#c81e1e') {

    /**
     * Dynamically loads the PT Mono font from Google Fonts.
     * Uses a global flag to ensure the font is only loaded once.
     * Falls back to a generic monospace font if loading fails.
     */
    async function loadGribnicaFont() {
        if (window.gribnicaMemeFontLoaded === true) {
            return '"PT Mono", monospace';
        }
        if (window.gribnicaMemeFontLoaded === 'failed') {
            return 'monospace';
        }

        try {
            const font = new FontFace('PT Mono', 'url(https://fonts.gstatic.com/s/ptmono/v13/9oRONryVp_u_-980sS4i7d8.woff2)');
            await font.load();
            document.fonts.add(font);
            window.gribnicaMemeFontLoaded = true;
            return '"PT Mono", monospace';
        } catch (e) {
            console.error('Font "PT Mono" could not be loaded:', e);
            window.gribnicaMemeFontLoaded = 'failed';
            return 'monospace';
        }
    }

    const fontFamily = await loadGribnicaFont();

    // 1. Create canvas and context
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');
    canvas.width = originalImg.naturalWidth;
    canvas.height = originalImg.naturalHeight;

    // 2. Apply vintage filters and draw the original image
    ctx.filter = `sepia(${sepia}) brightness(0.95) contrast(1.1)`;
    ctx.drawImage(originalImg, 0, 0, canvas.width, canvas.height);

    // 3. Add a subtle film grain/noise effect
    if (noise > 0) {
        const noiseCanvas = document.createElement('canvas');
        noiseCanvas.width = canvas.width;
        noiseCanvas.height = canvas.height;
        const noiseCtx = noiseCanvas.getContext('2d');
        
        const noiseData = noiseCtx.createImageData(canvas.width, canvas.height);
        const pixels = noiseData.data;
        for (let i = 0; i < pixels.length; i += 4) {
            const value = 128 + (Math.random() - 0.5) * 90; // Noise centered around mid-gray
            pixels[i] = pixels[i + 1] = pixels[i + 2] = value;
            pixels[i + 3] = 255;
        }
        noiseCtx.putImageData(noiseData, 0, 0);

        ctx.globalAlpha = Math.min(1.0, noise);
        ctx.globalCompositeOperation = 'overlay';
        ctx.drawImage(noiseCanvas, 0, 0);

        // Reset canvas state for subsequent drawing
        ctx.globalAlpha = 1.0;
        ctx.globalCompositeOperation = 'source-over';
    }
    
    ctx.filter = 'none';

    // 4. Draw the main title text
    const titleFontSize = Math.max(24, Math.round(canvas.width / 22));
    ctx.font = `bold ${titleFontSize}px ${fontFamily}`;
    ctx.fillStyle = textColor;
    ctx.textAlign = 'center';
    ctx.textBaseline = 'top';

    const textYPosition = canvas.height * 0.04;
    ctx.fillText(`ДЕЛО № ${caseNumber}`, canvas.width / 2, textYPosition);
    ctx.fillText('О ГРИБНИЦЕ', canvas.width / 2, textYPosition + titleFontSize * 1.3);

    // 5. Draw the rotated stamp
    if (stampText && stampText.trim() !== '') {
        const stampFontSize = Math.max(22, Math.round(canvas.width / 25));
        ctx.font = `bold ${stampFontSize}px ${fontFamily}`;
        ctx.fillStyle = stampColor;
        
        const stampX = canvas.width * 0.8;
        const stampY = canvas.height * 0.2;

        ctx.save();
        ctx.translate(stampX, stampY);
        ctx.rotate(-Math.PI / 12); // Rotate by ~15 degrees

        ctx.textAlign = 'center';
        ctx.textBaseline = 'middle';

        // Measure text for border
        const textMetrics = ctx.measureText(stampText);
        const padding = stampFontSize * 0.5;
        const rectWidth = textMetrics.width + padding;
        const rectHeight = (textMetrics.actualBoundingBoxAscent + textMetrics.actualBoundingBoxDescent) + padding;
        
        // Draw stamp border
        ctx.strokeStyle = stampColor;
        ctx.lineWidth = Math.max(2, stampFontSize / 8);
        ctx.strokeRect(-rectWidth / 2, -rectHeight / 2, rectWidth, rectHeight);
        
        // Draw stamp text
        ctx.fillText(stampText, 0, 0);

        ctx.restore();
    }

    // 6. Return the final canvas
    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 of the Case of Gribnica’ tool allows users to enhance and alter images by applying vintage-style effects and adding customized text. Users can input an original image along with a case number and a stamp text, which will be incorporated into the final image. The tool applies sepia filters, subtle film grain effects, and offers control over text and stamp colors. This tool can be particularly useful for creating stylized documents, nostalgic artwork, or themed presentations, making it ideal for artists, historians, or anyone looking to add a unique touch to their images.

Leave a Reply

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