Skip to content

Instantly share code, notes, and snippets.

@lordtangent
Created April 10, 2019 23:08
Show Gist options
  • Save lordtangent/87d7631b87bd3268ae9e978d26176e97 to your computer and use it in GitHub Desktop.
Save lordtangent/87d7631b87bd3268ae9e978d26176e97 to your computer and use it in GitHub Desktop.
Reformat images in-place with Open Image IO Tool
# Have a bunch of exr images on disk in the wrong codec that you need to convert?
# you could tie up a Nuke or Fusion and make a new copy of them to convert them, then blow away the originals.
# OR, you could just convert them in place with OpenImageIO http://openimageio.org
# "zip" is 16 line zip "zips" is single scan line zip (Nuke preferes single line zip over everything else)
# "piz" wavelet is more compact but slower to decode.
find . -type f -iname *.exr -exec iconvert -v --inplace --compression zip --scanline '{}' \;
# making proxies using oiiotool and Nuke's aces ocio config
# First make sure you are using the same ocio config as nuke
export OCIO="/usr/local/Nuke7.0v4/plugins/OCIOConfigs/configs/aces/config.ocio"
oiiotool A001C026_130327WZ00000.exr --resize 25% --colorconvert aces log -d uint8 -o A001C026_130327WZ_1k.00000.png
oiiotool A001C026_130327WZ00000.exr --resize 50% --colorconvert aces log -d uint8 -o A001C026_130327WZ_2k.00000.png
oiiotool A001C026_130327WZ00000.exr --colorconvert aces log -d uint8 -o A001C026_130327WZ_4k.00000.png
# oiiotool --resize seems to be only single threaded. Kind of slow. Use GNU parallel to speed it up.
# first build a list of jobs to run.
# Find the files to work on.
find -type f -name *.exr -exec echo "md5sum {}" \; > work_q
# edit the list to put the commands in that you want. Think of it as a giant todo list of commands.
cat work_q | parallel --eta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment