oiiotool Skill
Command-line image processing with OpenImageIO's oiiotool. Industry-standard tool used across VFX, CGI, game dev, and photography for format conversion, color management, compositing, and batch image operations.
Setup
CODEBLOCK0
This installs both the oiiotool CLI and the OpenImageIO Python module.
Verify:
CODEBLOCK1
OCIO / ACES Configuration
oiiotool uses OpenColorIO for color management. Since OCIO 2.2+, built-in ACES configs are available — no file download needed:
CODEBLOCK2
Available built-in configs:
- -
ocio://cg-config-latest — CG-focused config (no camera color spaces, lean). Recommended. - INLINECODE3 — Full studio config (includes camera color spaces).
- INLINECODE4 — Pin to a specific version.
For production studios with a custom config:
CODEBLOCK3
Check what's available:
CODEBLOCK4
Core Concept: Stack-Based Processing
oiiotool processes commands left to right on a stack:
- - Naming a file pushes it onto the stack
- Commands pop inputs, process, and push results
- INLINECODE5 writes the top of stack to a file
CODEBLOCK5
File Info & Metadata
CODEBLOCK6
Format Conversion
Supported formats: EXR, TIFF, PNG, JPEG, DPX, HDR (Radiance), BMP, TGA, GIF, WebP, JPEG2000, PSD, ICO, FITS, and more.
CODEBLOCK7
Production Tip: Selective Channel Reading
For large multichannel EXRs (beauty + depth + normals + crypto), read only what you need to save memory and time:
CODEBLOCK8
This is critical in production where EXRs can have 50+ channels and be hundreds of MB each.
Color Management (OCIO)
Color Space Conversion
CODEBLOCK9
ACES Display Transforms (Tone Mapping)
The proper way to view HDR content. Applies the ACES Reference Rendering Transform (RRT) + Output Device Transform (ODT) for correct highlight rolloff:
CODEBLOCK10
When to use display transforms vs colorconvert: Use --ociodisplay when converting HDR scene-referred data to a display for viewing (applies tone mapping). Use --colorconvert when converting between working color spaces (no tone mapping, preserves linearity).
OCIO Looks & File Transforms
CODEBLOCK11
Manual Matrix Color Conversion
When you don't have OCIO or need a specific 3x3 matrix:
CODEBLOCK12
Exposure Adjustment
EXR stores linear light values. Exposure in stops is powers of 2:
CODEBLOCK13
Exposure + ACES display transform (most useful combo for HDR review):
CODEBLOCK14
Exposure Reference Table
| Stops | Multiplier | Formula | Use Case |
|---|
| +8 | 256 | 2^8 | Deep shadow recovery |
| +6 |
64 | 2^6 | Dark shadow detail |
| +4 | 16 | 2^4 | Shadow detail |
| +2 | 4 | 2^2 | Slight brighten |
| 0 | 1 | 2^0 | Native exposure |
| -2 | 0.25 | 2^-2 | Slight darken |
| -4 | 0.0625 | 2^-4 | Highlight recovery |
| -6 | 0.015625 | 2^-6 | Bright highlight detail |
| -8 | 0.00390625| 2^-8 | Extreme highlight recovery |
Ready-Made Scripts
Exposure Sweep
Generate a composite contact sheet of multiple exposures from an HDR EXR:
CODEBLOCK15
EXR Sequence to Video
Convert an EXR image sequence to MP4:
CODEBLOCK16
Requires ffmpeg in PATH.
Image Operations
Resize & Fit
CODEBLOCK17
Available filters: box, triangle, gaussian, catmull-rom, blackman-harris, sinc, lanczos3, mitchell, bspline, cubic. Default lanczos3 is good for most uses.
Crop & Cut
CODEBLOCK18
Rotate & Flip
CODEBLOCK19
Blur & Sharpen
CODEBLOCK20
Channel Operations
CODEBLOCK21
Compositing
CODEBLOCK22
Color & Value Adjustments
CODEBLOCK23
Drawing & Annotation
CODEBLOCK24
Sequence Processing
oiiotool supports frame number wildcards for batch operations:
CODEBLOCK25
Sequence to Video (with ffmpeg)
Two-step process:
CODEBLOCK26
Or use the helper script: INLINECODE20
Texture Baking
CODEBLOCK27
Image Comparison
CODEBLOCK28
Patterns & Test Images
CODEBLOCK29
Metadata Manipulation
CODEBLOCK30
Deep Image Operations
CODEBLOCK31
Cryptomatte Visualization
CODEBLOCK32
For advanced cryptomatte extraction with custom palettes and batch processing, see the exr skill.
Performance Tips
- -
--threads N — control parallelism (default: all cores) - INLINECODE22 — parallelize sequence processing
- INLINECODE23 — read only needed channels from multichannel EXRs
- INLINECODE24 — increase image cache for large files
- INLINECODE25 — bypass cache for one-shot operations
- INLINECODE26 — better cache performance with large scanline images
- INLINECODE27 — update mode: skip outputs newer than inputs
Related Skills
- - exr — Python-level EXR internals: channel inspection, cryptomatte extraction with custom palettes, beauty pass extraction with ACEScg matrix. Use when you need fine-grained channel access or cryptomatte decoding beyond what
--cryptomatte-colors provides.
oiiotool 技能
使用OpenImageIO的oiiotool进行命令行图像处理。这是VFX、CGI、游戏开发和摄影领域用于格式转换、色彩管理、合成和批量图像操作的行业标准工具。
安装
bash
pip install openimageio
这将同时安装oiiotool命令行工具和OpenImageIO Python模块。
验证安装:
bash
oiiotool --version
oiiotool --list-formats
OCIO / ACES 配置
oiiotool使用OpenColorIO进行色彩管理。自OCIO 2.2+起,内置ACES配置可用——无需下载配置文件:
bash
使用内置ACES CG配置(推荐大多数用户使用)
export OCIO=ocio://cg-config-latest
或在每个命令中指定
oiiotool --colorconfig ocio://cg-config-latest input.exr ...
可用的内置配置:
- - ocio://cg-config-latest — 面向CG的配置(不含相机色彩空间,精简)。推荐使用。
- ocio://studio-config-latest — 完整工作室配置(包含相机色彩空间)。
- ocio://cg-config-v4.0.0aces-v2.0ocio-v2.5 — 锁定到特定版本。
对于使用自定义配置的制作工作室:
bash
export OCIO=/path/to/studio_config.ocio
查看可用配置:
bash
oiiotool --colorconfiginfo
核心概念:基于栈的处理
oiiotool在栈上从左到右处理命令:
- - 命名文件会将其推入栈
- 命令弹出输入,处理,并推入结果
- -o将栈顶内容写入文件
bash
读取 -> 处理 -> 写入
oiiotool input.exr --resize 1920x1080 -o output.png
两张图像 -> 合成 -> 写入
oiiotool fg.exr bg.exr --over -o comp.exr
文件信息与元数据
bash
基本信息(分辨率、通道、格式)
oiiotool --info input.exr
详细信息(所有元数据)
oiiotool --info -v input.exr
像素统计(每个通道的最小值、最大值、平均值、标准差)
oiiotool --stats input.exr
使用正则表达式过滤元数据
oiiotool --info -v --metamatch camera|lens input.exr
格式转换
支持的格式:EXR、TIFF、PNG、JPEG、DPX、HDR(Radiance)、BMP、TGA、GIF、WebP、JPEG2000、PSD、ICO、FITS等。
bash
简单转换(从扩展名推断格式)
oiiotool input.exr -o output.png
oiiotool input.dpx -o output.tiff
oiiotool input.hdr -o output.exr
控制输出位深度
oiiotool input.exr -d uint8 -o output.png # 8位
oiiotool input.exr -d uint16 -o output.png # 16位
oiiotool input.exr -d half -o output.exr # 16位浮点(半精度)
oiiotool input.exr -d float -o output.tiff # 32位浮点
JPEG质量
oiiotool input.exr -d uint8 --compression jpeg:95 -o output.jpg
EXR压缩类型
oiiotool input.exr --compression zip -o output.exr # 无损,通用性好
oiiotool input.exr --compression piz -o output.exr # 无损,最适合噪点/CG图像
oiiotool input.exr --compression zips -o output.exr # 无损,扫描线模式
oiiotool input.exr --compression dwaa:45 -o output.exr # 有损,文件极小
分块EXR与扫描线EXR
oiiotool input.exr --tile 64 64 -o output.exr
oiiotool input.exr --scanline -o output.exr
从高位深度转换到8位时添加抖动(减少条带效应)
oiiotool input.exr -d uint8 --dither -o output.png
制作技巧:选择性通道读取
对于大型多通道EXR(beauty + depth + normals + crypto),只读取所需通道以节省内存和时间:
bash
只读取R、G、B通道(跳过depth、normals、cryptomatte等)
oiiotool -i:ch=R,G,B input.exr -o output.png
结合转换和色彩管理
oiiotool -i:ch=R,G,B input.exr --resize 1024x0 --colorconvert ACES2065-1 Rec.1886 Rec.709 - Display --compression jpeg:90 -o output.jpg
这在制作中至关重要,因为EXR文件可能有50多个通道,每个文件数百MB。
色彩管理(OCIO)
色彩空间转换
bash
在命名色彩空间之间转换
oiiotool input.exr --colorconvert ACEScg sRGB - Texture -o output.png
oiiotool input.exr --colorconvert linear srgb -o output.png
oiiotool input.exr --tocolorspace sRGB - Texture -o output.png
设置假定的输入色彩空间(不改变像素)
oiiotool input.png --iscolorspace srgb --tocolorspace linear -o linear.exr
ACES显示变换(色调映射)
查看HDR内容的正确方法。应用ACES参考渲染变换(RRT)+ 输出设备变换(ODT)以获得正确的高光衰减:
bash
sRGB显示器(最常用于网页/审阅)
oiiotool input.exr --ociodisplay sRGB - Display ACES 1.0 - SDR Video -d uint8 -o output.png
Rec.709广播
oiiotool input.exr --ociodisplay Rec.1886 Rec.709 - Display ACES 1.0 - SDR Video -d uint8 -o output.png
DCI-P3影院
oiiotool input.exr --ociodisplay P3-D65 - Display ACES 1.0 - SDR Cinema -d uint8 -o output.png
HDR(1000尼特,PQ)
oiiotool input.exr --ociodisplay Rec.2100-PQ - Display ACES 1.1 - HDR Video (1000 nits & Rec.2020 lim) -d uint16 -o output.png
无色调映射(线性到显示,无RRT——适用于比较原始值)
oiiotool input.exr --ociodisplay sRGB - Display Un-tone-mapped -d uint8 -o output.png
何时使用显示变换与colorconvert: 将HDR场景参考数据转换为显示观看时使用--ociodisplay(应用色调映射)。在工作色彩空间之间转换时使用--colorconvert(无色调映射,保持线性)。
OCIO外观与文件变换
bash
应用OCIO外观(例如,ACES色域压缩)
oiiotool input.exr --ociolook ACES 1.3 Reference Gamut Compression -o output.exr
应用基于文件的变换(3D LUT、CDL、CLF)
oiiotool input.exr --ociofiletransform my_grade.cube -o output.exr
逆变换
oiiotool input.exr --ociofiletransform:inverse=1 my_grade.cube -o output.exr
手动矩阵色彩转换
当没有OCIO或需要特定的3x3矩阵时:
bash
ACEScg到线性sRGB(逗号分隔,行优先)
oiiotool input.exr --ccmatrix 1.70505,-0.62179,-0.08326,-0.13026,1.14080,-0.01055,-0.02400,-0.12897,1.15297 -o output.exr
曝光调整
EXR存储线性光值。以档为单位的曝光是2的幂:
bash
降低曝光(变暗)——揭示HDR高光
oiiotool input.exr --mulc 0.0625 -o output.exr # -4档
oiiotool input.exr --mulc 0.0078125 -o output.exr # -7档
提高曝光(变亮)——揭示阴影