How academysoftwarefoundation/openimageio works
Project Type and Purpose
• This is OpenImageIO (OIIO), a C++/Python tool-set and library for image file I/O, image buffering/processing, texture MIP-map lookups, and command-line utilities.
• It uses a plugin architecture: a core API (ImageInput/ImageOutput/ImageCache/TextureSystem/ImageBuf/ImageBufAlgo) dynamically loads format-specific plugins at runtime.
• It also provides command-line tools (oiiotool, iconvert, idiff, iinfo, igrep, iv) and Python bindings.
Main Components
a. Build & Configuration
• CMake project (CMakeLists.txt, src/cmake, conanfile.txt)
• Build-scripts (src/build-scripts)
• CI/CD workflows (.github/workflows)
b. Core Library
• libOpenImageIO (src/libOpenImageIO) – core classes and image algorithms
• libutil and libtexture – supporting utilities and texture subsystem
c. Plugin Manager
• Plugin registry within core library that discovers/loads format plugins
d. Format Plugins
• One directory per format (e.g., jpeg.imageio, openexr.imageio, png.imageio, raw.imageio, etc.)
• Each compiles to a shared library implementing ImageInput/ImageOutput interface
• External codec libs: libpng, libjpeg, OpenEXR, libraw, zlib, etc.
e. Command-line Tools
• oiiotool, iconvert, idiff, iinfo, igrep, iv (src/oiiotool, src/iconvert, …)
• Linked against core library and load plugins at runtime
f. Python Bindings
• PyBind11 wrappers (src/python) exposing core APIs to Python
g. Testsuite
• testsuite/… organizes tests by format and tool, invoking command-line tools or APIs
h. Documentation
• docs/… and docs/dev/Architecture.md describe high-level architecture
Relationships & Interactions
• Tools and Python bindings → call Core Library APIs → Plugin Manager → Format Plugin → External image-format libraries → Read/Write image files
• TextureSystem → built on top of ImageCache → manages on-disk caching + MIP-map filtering
• Build system compiles Core Library, Plugin Libraries, Tools, Python module; CI/CD automates testing/deployment
Architectural Patterns & Principles
• Plugin/Factory pattern: core API defines abstract ImageInput/ImageOutput; concrete implementations are discovered via registry and loaded dynamically
• Modular layering: core logic (libOpenImageIO) separated from format implementations (plugins) and front-ends (tools, Python)
• Separation of concerns:
• Core algorithms and data structures in libOpenImageIO
• Utilities (filesystem, threading, logging) in libutil
• Texture caching in libtexture
• Format-specific I/O in plugins
• User-facing interfaces in tools and Python module
• Build-time decoupling of external dependencies via CMake “Find…” modules and build-scripts
Essential Elements
• Clear labels: “libOpenImageIO”, “Plugin Manager”, “jpeg.imageio plugin”, “oiiotool”, “pybind11”, “CMake”