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
Chloros Desktop
Must be installed locally
License
Chloros+ (paid plan required)
Operating System
Windows 10/11 (64-bit)
Python
Python 3.7 or higher
Memory
8GB RAM minimum (16GB recommended)
Internet
Required for license activation
License Requirement: The Python SDK requires a paid Chloros+ subscription for API access. Standard (free) plans do not have API/SDK access. Visit https://cloud.mapir.camera/pricing to upgrade.
Quick Start
Installation
Install via pip:
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:
Chloros Desktop installed (download)
Python 3.7+ installed (python.org)
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:
Open Chloros or Chloros (Browser) and login on the User
tab. Or, open the CLI.
Enter your Chloros+ credentials and log in
License is cached locally (persists across reboots)
One-Time Setup: After logging in via the GUI or CLI, the SDK automatically uses the cached license. No additional authentication needed!
Test Connection
Verify the SDK can connect to Chloros:
API Reference
ChlorosLocal Class
Main class for local Chloros image processing.
Constructor
Parameters:
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_project(project_name, camera=None)Create a new Chloros project.
Parameters:
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(folder_path, recursive=False)Import images from a folder.
Parameters:
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(**settings)Configure processing settings.
Parameters:
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(mode="parallel", wait=True, progress_callback=None)Process the project images.
Parameters:
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
Parallel Mode: Requires Chloros+ license. Automatically scales to your CPU cores (up to 16 workers).
Example:
get_config()
get_config()Get current project configuration.
Returns: dict - Current project configuration
Example:
get_status()
get_status()Get backend status information.
Returns: dict - Backend status
Example:
shutdown_backend()
shutdown_backend()Shutdown the backend (if started by SDK).
Example:
logout()
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:
Convenience Functions
process_folder(folder_path, **options)
process_folder(folder_path, **options)One-line convenience function to process a folder.
Parameters:
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:
Verify Chloros Desktop is installed:
Check Windows Firewall isn't blocking
Try manual backend path:
License Not Detected
Issue: SDK warns about missing license
Solutions:
Open Chloros, Chloros (Browser) or Chloros CLI and login.
Verify license is cached:
If experiencing credential issues, clear cached credentials and re-login:
Contact support: info@mapir.camera
Import Errors
Issue: ModuleNotFoundError: No module named 'chloros_sdk'
Solutions:
Processing Timeout
Issue: Processing times out
Solutions:
Increase timeout:
Process smaller batches
Check available disk space
Monitor system resources
Port Already in Use
Issue: Backend port 5000 occupied
Solutions:
Or find and close conflicting process:
Performance Tips
Optimize Processing Speed
Use Parallel Mode (requires Chloros+)
Reduce Output Resolution (if acceptable)
Disable Unnecessary Indices
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?
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
Email: info@mapir.camera
Pricing: https://cloud.mapir.camera/pricing
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