The Best Node.js Library for Shipping Container OCR

Stop using regex. Extract structured data from Shipping Containers with 99% accuracy using Node.js.

Shipping Container OCR extraction process diagram
StructOCR transforms raw Shipping Container images into validated JSON.

The Problem with Shipping Container Parsing

Shipping container parsing is notoriously difficult. Challenges include container numbers printed vertically, extreme rust and wear, skewed angles from terminal cameras, low-light conditions, and physical damage. Traditional methods relying on regex or standard text recognition libraries fail to handle these severe environmental variations, resulting in low accuracy and automated gate bottlenecks.

The StructOCR Solution

StructOCR leverages advanced AI and deep learning models specifically trained on shipping container data, offering a robust ISO 6346 compliant extraction. Our solution automatically deskews images, isolates the container ID, and intelligently extracts data, even from challenging vertical text, to optimize logistics workflows. We handle rust, glare, and non-standard layouts with ease, returning validated JSON in seconds.

Common Use Cases

  • Terminal Automation: Speed up gate operations and yard management by instantly capturing container numbers.
  • Customs & Compliance: Automate cross-border document verification and manifesting.
  • Asset Tracking: Monitor shipping container movements across the global supply chain with real-time data.

Implementation: Using the SDK

Complete, runnable Node.js code to extract data from a Shipping Container.

Prerequisite: npm install structocr

CODE EXAMPLE
// 💰 Save 30%+ vs competitors. Get 20 free credits instantly:
// 👉 https://structocr.com/register

const StructOCR = require('structocr');

async function scanShippingContainer(imagePath) {
  // Initialize the SDK with your API Key
  const client = new StructOCR('YOUR_API_KEY');

  try {
    console.log(`Scanning container image: ${imagePath}...`);
    
    // The SDK handles file reading and API communication
    const result = await client.scanContainer(imagePath);

    if (result.success) {
      console.log('✅ Extraction Successful!\n');
      
      const { data } = result;
      console.log('Container Number:', data.container_number);
      console.log('Is Valid (ISO 6346):', data.is_valid);
      console.log('Confidence:', data.confidence, '\n');

      const parsed = data.parsed;
      console.log('--- Parsed Details ---');
      console.log('Owner Code:', parsed.owner_code);
      console.log('Category:', parsed.category);
      console.log('Serial Number:', parsed.serial_number);
      console.log('Check Digit:', parsed.check_digit);

    } else {
      console.error('❌ Extraction Failed:', result.error);
    }
  } catch (error) {
    console.error('SDK Error:', error.message);
    if (error.cause) {
      console.error('Underlying Error:', error.cause);
    }
  }
}

// Example usage:
scanShippingContainer('path/to/your/container_image.jpg');

Technical Specs

  • Latency: < 5s (Average)
  • Uptime: 98.5% SLA
  • Security: AES-256 Encryption & SOC2 Compliant
  • Input: JPG, PNG, WebP (Max 4.5MB)
  • Output: JSON (Structured Data)

Key Features

  • Smart Crop: Auto-detects container boundaries.
  • ISO 6346 Validation: Cross-validates owner codes and checksums automatically.
  • Specialized Models: Trained specifically on vertical and degraded Shipping Container text.

Sample JSON Response

The API returns a clean JSON object with normalized, parsed container fields.

{
  "success": true,
  "data": {
    "container_number": "TTNU5194822",
    "is_valid": true,
    "confidence": "High",
    "parsed": {
      "owner_code": "TTN",
      "category": "U",
      "serial_number": "519482",
      "check_digit": "2"
    }
  }
}

Frequently Asked Questions

What file formats are supported?

JPG, PNG, and WebP images up to 4.5MB.

Is data stored?

No. Images are processed in-memory and deleted immediately.

How to handle errors?

Check the 'success' flag and 'error' message in the response.

More OCR Tutorials

Precise Data Extraction and Seamless Integration with AI-powered OCR API.

Empower your solutions with automated data extraction by integrating best-in class StructOCR via API seamlessly.

No credit card required • Full API access included