API : Python SDK

The Chloros Python SDK provides programmatic access to the Chloros image processing engine, enabling automation, custom workflows, and seamless integration with your Python applications and research pipelines.

Key Features

  • 🐍 Native Python - Clean, Pythonic API for image processing

  • 🔧 Full API Access - Complete control over Chloros processing

  • 🚀 Automation - Build custom batch processing workflows

  • 🔗 Integration - Embed Chloros in existing Python applications

  • 📊 Research-Ready - Perfect for scientific analysis pipelines

  • Parallel Processing - Scales to your CPU cores (Chloros+)

Requirements

Requirement
Details

Chloros Desktop

Must be installed locally

License

Operating System

Windows 10/11 (64-bit)

Python

Python 3.7 or higher

Memory

8GB RAM minimum (16GB recommended)

Internet

Required for license activation

Quick Start

Installation

Install via pip:

First-Time Setup: Before using the SDK, activate your Chloros+ license by opening Chloros, Chloros (Browser) or Chloros CLI and logging in with your credentials. This only needs to be done once.

Basic Usage

Process a folder with just a few lines:

Full Control

For advanced workflows:


Installation Guide

Prerequisites

Before installing the SDK, ensure you have:

  1. Chloros Desktop installed (download)

  2. Python 3.7+ installed (python.org)

  3. Active Chloros+ license (upgrade)

Install via pip

Standard installation:

With progress monitoring support:

Development installation:

Verify Installation

Test that the SDK is installed correctly:


First-Time Setup

License Activation

The SDK uses the same license as Chloros, Chloros (Browser), and Chloros CLI. Activate once via the GUI or CLI:

  1. Open Chloros or Chloros (Browser) and login on the User tab. Or, open the CLI.

  2. Enter your Chloros+ credentials and log in

  3. License is cached locally (persists across reboots)

Logout: SDK users can programmatically clear cached credentials using the logout() method. See logout() method in the API Reference.

Test Connection

Verify the SDK can connect to Chloros:


API Reference

ChlorosLocal Class

Main class for local Chloros image processing.

Constructor

Parameters:

Parameter
Type
Default
Description

api_url

str

"http://localhost:5000"

URL of local Chloros backend

auto_start_backend

bool

True

Automatically start backend if needed

backend_exe

str

None (auto-detect)

Path to backend executable

timeout

int

30

Request timeout in seconds

backend_startup_timeout

int

60

Timeout for backend startup (seconds)

Examples:


Methods

create_project(project_name, camera=None)

Create a new Chloros project.

Parameters:

Parameter
Type
Required
Description

project_name

str

Yes

Name for the project

camera

str

No

Camera template (e.g., "Survey3N_RGN", "Survey3W_OCN")

Returns: dict - Project creation response

Example:


import_images(folder_path, recursive=False)

Import images from a folder.

Parameters:

Parameter
Type
Required
Description

folder_path

str/Path

Yes

Path to folder with images

recursive

bool

No

Search subfolders (default: False)

Returns: dict - Import results with file count

Example:


configure(**settings)

Configure processing settings.

Parameters:

Parameter
Type
Default
Description

debayer

str

"High Quality (Faster)"

Debayer method

vignette_correction

bool

True

Enable vignette correction

reflectance_calibration

bool

True

Enable reflectance calibration

indices

list

None

Vegetation indices to calculate

export_format

str

"TIFF (16-bit)"

Output format

ppk

bool

False

Enable PPK corrections

custom_settings

dict

None

Advanced custom settings

Export Formats:

  • "TIFF (16-bit)" - Recommended for GIS/photogrammetry

  • "TIFF (32-bit, Percent)" - Scientific analysis

  • "PNG (8-bit)" - Visual inspection

  • "JPG (8-bit)" - Compressed output

Available Indices:

NDVI, NDRE, GNDVI, OSAVI, CIG, EVI, SAVI, MSAVI, MTVI2, and more.

Example:


process(mode="parallel", wait=True, progress_callback=None)

Process the project images.

Parameters:

Parameter
Type
Default
Description

mode

str

"parallel"

Processing mode: "parallel" or "serial"

wait

bool

True

Wait for completion

progress_callback

callable

None

Progress callback function(progress, msg)

poll_interval

float

2.0

Polling interval for progress (seconds)

Returns: dict - Processing results

Example:


get_config()

Get current project configuration.

Returns: dict - Current project configuration

Example:


get_status()

Get backend status information.

Returns: dict - Backend status

Example:


shutdown_backend()

Shutdown the backend (if started by SDK).

Example:


logout()

Clear cached credentials from the local system.

Description:

Programmatically logs out by removing cached authentication credentials. This is useful for:

  • Switching between different Chloros+ accounts

  • Clearing credentials in automated environments

  • Security purposes (e.g., removing credentials before uninstalling)

Returns: dict - Logout operation result

Example:

Re-authentication Required: After calling logout(), you must log in again via Chloros, Chloros (Browser), or Chloros CLI before using the SDK.


Convenience Functions

process_folder(folder_path, **options)

One-line convenience function to process a folder.

Parameters:

Parameter
Type
Default
Description

folder_path

str/Path

Required

Path to folder with images

project_name

str

Auto-generated

Project name

camera

str

None

Camera template

indices

list

["NDVI"]

Indices to calculate

vignette_correction

bool

True

Enable vignette correction

reflectance_calibration

bool

True

Enable reflectance calibration

export_format

str

"TIFF (16-bit)"

Output format

mode

str

"parallel"

Processing mode

progress_callback

callable

None

Progress callback

Returns: dict - Processing results

Example:


Context Manager Support

The SDK supports context managers for automatic cleanup:


Complete Examples

Example 1: Basic Processing

Process a folder with default settings:


Example 2: Custom Workflow

Full control over processing pipeline:


Example 3: Batch Processing Multiple Folders

Process multiple flight datasets:


Example 4: Research Pipeline Integration

Integrate Chloros with data analysis:


Example 5: Custom Progress Monitoring

Advanced progress tracking with logging:


Example 6: Error Handling

Robust error handling for production use:


Example 7: Account Management and Logout

Manage credentials programmatically:


Example 8: Command-Line Tool

Build a custom CLI tool with the SDK:

Usage:


Exception Handling

The SDK provides specific exception classes for different error types:

Exception Hierarchy

Exception Examples


Advanced Topics

Custom Backend Configuration

Use a custom backend location or configuration:

Non-Blocking Processing

Start processing and continue with other tasks:

Memory Management

For large datasets, process in batches:


Troubleshooting

Backend Not Starting

Issue: SDK fails to start backend

Solutions:

  1. Verify Chloros Desktop is installed:

  1. Check Windows Firewall isn't blocking

  2. Try manual backend path:


License Not Detected

Issue: SDK warns about missing license

Solutions:

  1. Open Chloros, Chloros (Browser) or Chloros CLI and login.

  2. Verify license is cached:

  1. If experiencing credential issues, clear cached credentials and re-login:

  1. Contact support: info@mapir.camera


Import Errors

Issue: ModuleNotFoundError: No module named 'chloros_sdk'

Solutions:


Processing Timeout

Issue: Processing times out

Solutions:

  1. Increase timeout:

  1. Process smaller batches

  2. Check available disk space

  3. Monitor system resources


Port Already in Use

Issue: Backend port 5000 occupied

Solutions:

Or find and close conflicting process:


Performance Tips

Optimize Processing Speed

  1. Use Parallel Mode (requires Chloros+)

  1. Reduce Output Resolution (if acceptable)

  1. Disable Unnecessary Indices

  1. Process on SSD (not HDD)


Memory Optimization

For large datasets:


Background Processing

Free up Python for other tasks:


Integration Examples

Django Integration

Flask API

Jupyter Notebook


FAQ

Q: Does the SDK require an internet connection?

A: Only for initial license activation. After logging in via Chloros, Chloros (Browser) or Chloros CLI the license is cached locally and works offline for 30 days.


Q: Can I use the SDK on a server without GUI?

A: Yes! Requirements:

  • Windows Server 2016 or later

  • Chloros installed (one-time)

  • License activated on any machine (cached license copied to server)


Q: What's the difference between Desktop, CLI, and SDK?

Feature
Desktop GUI
CLI Command Line
Python SDK

Interface

Point-click

Command

Python API

Best For

Visual work

Scripting

Integration

Automation

Limited

Good

Excellent

Flexibility

Basic

Good

Maximum

License

Chloros+

Chloros+

Chloros+


Q: Can I distribute apps built with the SDK?

A: SDK code can be integrated into your applications, but:

  • End users need Chloros installed

  • End users need active Chloros+ licenses

  • Commercial distribution requires OEM licensing

Contact info@mapir.camera for OEM inquiries.


Q: How do I update the SDK?


Q: Where are processed images saved?

By default, in the Project Path :


Q: Can I process images from Python scripts running on schedule?

A: Yes! Use Windows Task Scheduler with Python scripts:

Schedule via Task Scheduler to run daily.


Q: Does the SDK support async/await?

A: Current version is synchronous. For async behavior, use wait=False or run in separate thread:


Q: How do I switch between different Chloros+ accounts?

A: Use the logout() method to clear cached credentials, then re-login with the new account:

After logout, authenticate with the new account via the GUI, Browser, or CLI before using the SDK again.


Getting Help

Documentation

  • API Reference: This page

Support Channels

Sample Code

All examples listed here are tested and production-ready. Copy and adapt them for your use case.


License

Proprietary Software - Copyright (c) 2025 MAPIR Inc.

SDK requires an active Chloros+ subscription. Unauthorized use, distribution, or modification is prohibited.

Last updated