GreycLab / gmic-community

Community contributions to the G'MIC software
http://gmic.eu
156 stars 26 forks source link

Where to find film emulation filters? #277

Closed mainrs closed 1 year ago

mainrs commented 1 year ago

I stumbled across this blog post about film emulation: https://patdavid.net/2013/09/film-emulation-presets-in-gmic-gimp/

It mentions that this project has them builtin. However, I could not find the filters within the repository. Where exactly are they?

dtschump commented 1 year ago

They are available in filter Colors / Simulate Film

image

mainrs commented 1 year ago

Thanks for the answer. I was looking into how these are actually implemented. The blog post I mentioned writes about color LOT, but I couldn't find them in the repository. Can you help me out?

dtschump commented 1 year ago

In that case, the implementation is located in the G'MIC stdlib : https://raw.githubusercontent.com/GreycLab/gmic/master/src/gmic_stdlib.gmic (filter 'Simulate Film`, line 45798).

This filter is based on the use of the decompress_clut command (defined at line 11139), and map_clut (defined at line 12907). All the Color LUTs are stored in file gmic_cluts.gmz (https://github.com/GreycLab/gmic/blob/master/resources/gmic_cluts.gmz), in a compressed form. The compression algorithm used is described in this research paper : Reconstruction of Smooth 3D Color Functions from Keypoints: Application to Lossy Compression and Exemplar-Based Generation of Color LUTs.

All this together makes actually a quite complex filter to understand.

mainrs commented 1 year ago

Thank you for the detailed explanations! Before putting effort into something that already exists:

Is there a CLI or other tool that allows be to unpack the gmic_cluts.gmz archive file?

dtschump commented 1 year ago

There is a way to uncompress all G'MIC cluts as .cube files, with the gmic command line:

$ gmic gmic/resources/gmic_cluts.gmz foreach { decompress_clut 33 o {n}.cube }

Beware, this takes a lot of time (+1100 cluts to decompress). (the file gmic_cluts.gmz can be found here : https://github.com/GreycLab/gmic/blob/master/resources/gmic_cluts.gmz)

mainrs commented 1 year ago

Thank you!