Skip to main content

Decode Cryptomattes in EXR file to PNG masks.

Project description

Kriptomatte_icon.png

Kriptomatte: Making Cryptomattes Easier for 2D Artists

This document outlines the Kriptomatte project, which aims to bring Cryptomatte functionality to Krita, the popular open-source painting software.

中文

What is Kriptomatte and What is this repo?

Kriptomatte is a tool that helps artists work with Cryptomattes, which are special masks embedded within EXR image files. These masks isolate objects, materials, and assets, making them easier to select and manipulate in video post-processing software.

Unfortunately, typical 2D image editing software doesn't work well with Cryptomattes, so artists often rely on ID Passes. While many popular software packages, such as Blender, lack the option to render ID passes, the codes in this repo (Kriptomatte Phase 1) offer a solution. Kriptomatte converts Cryptomatte information into ID Pass-like masks that can be used in painting software like Krita, Photoshop, and Clip Studio.

Kriptomatte Sample.png

Seperated Masks are also exported for a finer control.

Kriptomatte_Seperate_Mask.png

Project Phases

The Kriptomatte project is planned for four phases:

Phase 1: Python Script (Current Phase)

https://pypi.org/project/kriptomatte/

This phase focuses on creating a Python script that can extract Cryptomatte information from EXR files and convert it into separate, colored PNG images with alpha channels. This makes Cryptomattes more accessible to artists who can use these PNGs for painting in any software they prefer.

Phase 2: Standalone Executable

Phase 2 will rewrite the Python script in C++ to create a faster, standalone executable program. This program won't require any command-line experience; artists can simply drag and drop their EXR files onto the executable to generate the PNGs.

Phase 3a & 3b: Krita Integration

The final phases involve integrating Kriptomatte functionality directly into Krita. Phase 3a will focus on creating a C++ port of the code, while Phase 3b will develop a Python plugin for Krita.

Usage

Installation

You can install the script using pip from your command prompt (also known as a terminal). If you're unfamiliar with the concept, think of it as a special window where you type commands for your computer to execute. Here's how to open it on Windows: hold Shift and right-click on your desktop, then select "Open PowerShell here" or "Open Windows Terminal here." Once the terminal opens, copy and paste one of the following commands to install:

python -m pip install kriptomatte
# or
pip install kriptomatte

Use from Terminal

After installation, you can use the script in your terminal. Open the terminal again, navigate to the directory containing your EXR file, and run the following command, replacing "path/to/your/file.exr" with the actual path to your file:

To easily find the path to your EXR file on Windows, left-click it, then type alt + 3. This will copy the file location to your clipboard. You can then paste it into the command. If the hotkey doesn't work, you can find a light blue option to copy the file path in the top-left corner of your File Explorer.

kriptomatte -i "path to your exr file"
# for example
kriptomatte  -i "C:\Users\GrandArth\Pictures\sample.exr"

Important Note:

Currently, the script only supports Cryptomattes stored in 32-bit EXR files. Ensure your EXR files are rendered with 32-bit precision for the script to work correctly.

Code Reference

Friedman, Jonah, and Andrew C. Jones. 2015. “Fully Automatic ID Mattes with Support for Motion Blur and Transparency.” In ACM SIGGRAPH 2015 Posters, 1–1. Los Angeles California: ACM. https://doi.org/10.1145/2787626.2787629.
“OpenEXR Bindings for Python.” n.d. Accessed July 17, 2024. https://www.excamera.com/sphinx/articles-openexr.html.
“Psyop/Cryptomatte.” (2015) 2024. Python. Psyop. https://github.com/Psyop/Cryptomatte.
“Synthesis-AI-Dev/Exr-Info: Package with Helper Modules to Process EXR Files Generated by Renders.” n.d. Accessed July 21, 2024. https://github.com/Synthesis-AI-Dev/exr-info.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kriptomatte-0.0.14.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kriptomatte-0.0.14-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file kriptomatte-0.0.14.tar.gz.

File metadata

  • Download URL: kriptomatte-0.0.14.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for kriptomatte-0.0.14.tar.gz
Algorithm Hash digest
SHA256 f2df868e00e7b57f8e9054691eb58baf9ddd5d1765d6457eb7b1874b1cec69d4
MD5 ac5a8902c8ac236acbdf937cab3804ea
BLAKE2b-256 bcf63fd408db88b81b11a03507706c1f6d7303e5c2db1527eee95151265a542a

See more details on using hashes here.

File details

Details for the file kriptomatte-0.0.14-py3-none-any.whl.

File metadata

  • Download URL: kriptomatte-0.0.14-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for kriptomatte-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 61cfcca9bc729bb555f3a75b4d1884fd0de215931fe5a002dc61936fc489688d
MD5 3ead3139e76e76e05e719ee0bfa85627
BLAKE2b-256 23dd925d4efef1ebfddacd42296b8a584fbf4a0c9008aa68835868731f3c2911

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page