How to apply 3D LUT to a CR2 file via the command line?

I’m trying to figure out how I can take a .cr2 file (Canon RAW image), apply a 3D LUT (preferably a .cube file) to it, then save the result as a .png image – all through the Windows command line.

It seems that this might be possible with DarkTable, but I’ve not figured out how to do it.

If this isn’t possible to do with DarkTable, what’s another way to go about this?

Should be possible… do your edit and that will create an xmp file that has the LUT added. THen you can command line using that xmp for your other images… should work…

https://docs.darktable.org/usermanual/4.0/en/special-topics/program-invocation/darktable-cli/

Thank you, Todd – I’ll give that a try :+1:

Using ImageMagick:

magick in.cr2 myclut.cube -hald-clut out.tiff

EDIT: Sorry, you wanted a PNG output, so:

magick in.cr2 myclut.cube -hald-clut out.png
2 Likes

Thank you, Alan. I had originally tried doing this with ImageMagick before attempting to use DarkTable, but I couldn’t figure out the syntax in ImageMagick either. Your ImageMagick command did not totally work, but I was able to figure it out based on what you provided. The correct syntax for applying a LUT file in .cube format is this:

magick in.cr2 cube:myclut.cube -hald-clut out.png

Thanks again!

The only reason maybe to go DT would be that you could apply and entire edit so the LUT and any other changes at the same time…but I am not sure if you need that…

I plan to get more familiar with DarkTable, as it looks really useful. And I could see myself needing a command line to get a bunch of changes (including adding a LUT) at the same time, so I will probably use that technique in the future. But for what I need right now – just a command line for adding a LUT – ImageMagick should work well. Thanks!

Perfect… ya the DT thing would be like doing an edit in DT including adding your LUT… any tweaks and then you would have the xmp file…then its a similar command line thing… specify your raw your xmp and output file name…

Ah, yes, sorry, I had forgotten that .cube files need a cube: prefix.

You can also “select a level”, whatever that mean, with “cube:myclut.cube[8]” or whatever.

See ImageMagick – Image Formats and search for “cube”.