Bangladesh Smart NID OCR Python SDK

Instantly extract bilingual Bengali/English data and validate 2D barcode digital payloads from Bangladeshi IDs using our native Python library.

AI extracting complex Bengali conjunct characters and decoding the PDF417 2D barcode from a Bangladesh Smart NID card
StructOCR engine extracting Bilingual Visual Zone (VIZ) and decoding the 2D Barcode on a Bangladeshi document in real-time.

Parsing Smart NID Challenges

Extracting data from Bangladeshi Smart NIDs presents unique challenges. Firstly, Bilingual Complexity: the cards contain both Bengali (Bangla) and English text. Standard OCR engines often fail to accurately interpret the complex conjunct characters (যুক্তাক্ষর) of the Bengali script. Secondly, unlike many international IDs, the Smart NID lacks a traditional Machine-Readable Zone (MRZ), relying instead on a dense 2D barcode on the reverse side, making mathematical cross-validation more difficult for generic text-parsing APIs.

Why StructOCR for Bangladesh

Our AI model is pre-trained on hundreds of thousands of Bangladeshi Smart NID samples, enabling advanced national id ocr capabilities. This specialized training ensures over 99% accuracy on both complex Bengali typography and standard English fields. The Python SDK handles all the complexity of image preprocessing, bilingual extraction, and payload decryption, allowing you to deploy seamless kyc automation into your application effortlessly.

Common Use Cases in South Asia

  • Digital Onboarding: Verify users for Mobile Financial Services (MFS) like bKash or Nagad by pre-filling NID data instantly.
  • Telecom Registration: Automate robust SIM card registration with native Bengali character extraction.
  • Pan-South Asia Expansion: Seamlessly process users across the Indian subcontinent. Our unified Python SDK automatically detects and extracts data from neighboring documents, such as the India Aadhaar or Pakistan CNIC, without requiring any custom rules.

Live Demo: ID card scanner

No registration required. Upload a file to test the extraction.

1
Upload
2
Results

Drop files here or click to browse

JPG · PNG · WebP  ·  up to 500 files · max 4.5 MB each

No files selected
Need more testing? Create a free account to get 200 free credits (equals 100 National ID scans).

Python SDK Integration

Install the SDK via pip: `pip install structocr`. The SDK automatically maps the 10-digit Smart NID fields and gracefully handles the absence of MRZ data.

Prerequisite: Python 3.6+ and `structocr` library installed.

from structocr import StructOCR

# 🔑 Need a key for Bangladesh? Get 200 free credits instantly:
# 👉 https://structocr.com/register
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")

def scan_bangladesh_id():
    # Note: Supports JPG, PNG, WebP (Max 4.5MB)
    image_path = "bangladesh_smart_nid_front_back.jpg"

    try:
        print(f"Scanning {image_path}...")
        result = client.scan_national_id(image_path)

        if result.get('success'):
            data = result['data']
            print("✅ Bangladesh Smart NID Extraction Successful!")
            
            # Basic Identity
            print(f"Region:      {data.get('country_code')}")
            print(f"Name (EN):   {data.get('given_names')} {data.get('surname')}")
            print(f"NID Number:  {data.get('document_number')}")
            
            # Demographics
            print(f"DOB:         {data.get('date_of_birth')} ({data.get('sex')})")
            print(f"Address:     {data.get('address')}")
            
            # Note: Smart NID lacks MRZ, payload is strictly null in MRZ fields
            additional = data.get('additional_fields', {})
            if not additional.get('mrz_line_1'):
                print("\nℹ️ Document verified: PDF417 Barcode parsed. No standard MRZ present.")
        else:
            print(f"❌ Extraction Failed: {result.get('error')}")

    except Exception as e:
        print(f"An error occurred: {e}")

if __name__ == "__main__":
    scan_bangladesh_id()

Technical Specs

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

Key Features

  • Native Bengali OCR: Perfectly captures complex conjunct characters (যুক্তাক্ষর) without rendering errors.
  • 2D Barcode Parsing: Automatically locates and decodes the PDF417 barcode on the back of the Smart NID.
  • Format Validation: Cross-checks the 10-digit Smart NID number structure natively.
  • Smart Crop: Removes background noise and deskews rotated images automatically, ideal for user-submitted mobile photos.

JSON Response Example

The SDK returns a Python dictionary containing the parsed visual data in both English and Bengali. Unused MRZ and LatAm fields are safely returned as null.

{
  "success": true,
  "data": {
    "type": "national_id",
    "country_code": "BGD",
    "nationality": "BANGLADESHI",
    "document_number": "8293481234",
    "card_series": "",
    "personal_number": "8293481234",
    "surname": "AHMED",
    "given_names": "RAHIM",
    "sex": "M",
    "date_of_birth": "1990-05-15",
    "place_of_birth": "DHAKA",
    "address": "বাসা নং ১২, রোড নং ৫, ধানমন্ডি, ঢাকা",
    "date_of_issue": "2020-01-01",
    "date_of_expiry": "2035-01-01",
    "issuing_authority": "Govt. of Bangladesh",
    "additional_fields": {
      "phone_number": null,
      "tramite_number": null,
      "ejemplar": null,
      "mrz_line_1": null,
      "mrz_line_2": null,
      "mrz_line_3": null
    }
  }
}

Frequently Asked Questions

Does the Bangladesh Smart NID have a Machine Readable Zone (MRZ)?

No, unlike many global IDs, the Bangladesh Smart NID does not use a standard ICAO MRZ. Instead, it features a PDF417 2D barcode on the reverse side. Our SDK natively locates and decodes this barcode to verify data integrity.

Can the SDK accurately extract Bengali (Bangla) text?

Absolutely. The models are explicitly trained on Bangladeshi documents and natively process complex Bengali conjunct characters (যুক্তাক্ষর) right alongside English text, outputting clean, standardized Unicode strings.

How does it handle older paper or laminated NID cards?

Our engine is trained on both the modern polycarbonate Smart NIDs (10-digit numbers) and the legacy paper-based laminated NID cards (13 or 17-digit numbers), automatically adjusting its extraction logic based on the detected layout.

You May Also Like

Related tutorials, platform guides, and comparisons

Country Tutorial

Egypt ID OCR API & Python SDK

Python Tutorial: Automate KYC in Egypt. Extract data from National IDs using our SDK. Upload an image to test our ID OCR engine live for free.

Python · National ID
Country Tutorial

Kenya National ID (Maisha Card) OCR Python SDK

Python Tutorial: Automate KYC in Kenya. Extract data, Maisha Namba (UPI), and validate TD1 MRZ from National ID (Maisha Card) using StructOCR Python SDK.

Python · National ID
Country Tutorial

Uganda National ID Card OCR Python SDK

Python Tutorial: Automate KYC in Uganda. Extract data from National ID Card using StructOCR Python SDK. Supports native text and MRZ extraction.

Python · National ID
Country Tutorial

Tanzania NIDA Card OCR Python SDK

Python Tutorial: Automate KYC in Tanzania. Extract data from NIDA Card using StructOCR Python SDK. Supports native text and MRZ extraction.

Python · National ID
Country Tutorial

Côte d'Ivoire CNI (Carte Nationale d'Identité) OCR Python SDK

Python Tutorial: Automate KYC in Côte d'Ivoire. Extract French text, NNI, and validate TD1 MRZ from the ONECI CNI using StructOCR Python SDK.

Python · National ID
Country Tutorial

France Carte Nationale d'Identité OCR Python SDK

Python Tutorial: Automate KYC in France. Extract data from Carte Nationale d'Identité and validate TD1/TD2 MRZ using StructOCR Python SDK. Supports native text.

Python · National ID
Country Tutorial

Ukraine National ID OCR Python SDK

Python Tutorial: Automate KYC in Ukraine. Extract data from National ID using StructOCR Python SDK. Supports native text and MRZ extraction.

Python · National ID
Tutorial

C# National ID OCR API

Upload an image for a free test! Eliminate manual data entry for national IDs. Integrate hybrid VIZ + MRZ validation into your .NET apps. This C# OCR API delivers structured JSON in <5s average latency, backed by 98.5% uptime SLA and AES-256 encryption.

C# · National ID
Tutorial

PHP National ID OCR API

High-accuracy National ID OCR for PHP. Upload an image for a free test! Get structured JSON output from ID card images. A superior alternative to Tesseract. No complex PHP SDK needed.

PHP · National ID
Tutorial

Go National ID OCR API

Upload an image for a free test! High-accuracy National ID data extraction for Go developers. Get structured JSON output via a simple API call, replacing unreliable open-source tools.

Go · National ID

Technical Comparisons & Integrations

Explore platform integrations and competitive analysis

From tutorial to production in 5 minutes.

You've seen the code. Now get your API key, grab your 200 free credits, and see it work with your own images. No credit card required.

Instant Access Cancel Anytime 99.9% Uptime