Having Issues Adding Film Grain

Hello friends!

I have been scouring these forums and the Google for a few days now to see if I could figure this out on my own… but to no avail. I hope this hasn’t been answered elsewhere, but I could sure use some help!

So, what I’ve been trying to do is to add film grain to a bunch of images at once instead of opening each file in GIMP, applying the filter, then saving. Thats when I decided to dive head first into gmic’s CLI. And now I am fully in the rabbit hole.

The command I am using is -fx_simulate_grain 0,1,0.286,100,0,-0.2,0,-2,0,0,0,0 which I found out how to write using verbose mode (layer name) in the GIMP G’mic Plugin. Fiddling around with the settings, the string of numbers should represent the:

  • “Orwo NP20-GDR” grain type
  • Grain Merge Blend mode
  • Opacity at 0.286
  • Scale at 100
  • Colored Grain NOT checked
  • Brightness at -0.2
  • Contrast at 0
  • Gamma at -2
  • Hue, Saturation, and the rest at 0

Using this on a lower bit image like a png works fine.

$ gmic image.png -fx_simulate_grain 0,1,0.286,100,0,-0.2,0,-2,0,0,0,0 -o output.png

That even outputs an image that looks like the input (oooowweeee that was hard figuring that out, and yes I still have questions on it) with the grain added.

But when I attempt to use a 32 bit float tiff that I have exported from RawTherapee, most of the blend modes end up producing just grain against a black background.

$ gmic image.tif -fx_simulate_grain 0,1,0.286,100,0,-0.2,0,-2,0,0,0,0 -n 0,65535 -o output.tif,ushort

This puts out a black background splattered with small dots. Yet if I change the blend mode setting to 3, 4, or 5 it works like its supposed to (with 5 it’s just grain only).

I am running Gmic 2.8.4 that I downloaded from aferrero2707 and have ran $ gmic update, on a Macbook Pro Retina late 2012 running osx 10.12.6 (I know its old, but at least this version supports the supplied graphics card)

Here are some links to let you experiment:

The PNG I Used

The Grainy Result PNG

The 32bit Float Tiff I Used

The Unwanted Result

One Result that Worked

And Another

The Grain settings are in the files name. Thank you all sooooooooo much for your help!! If you need anymore info from me let me know.

Peace!
BPVW

And as a side note, -n 0,65535 -o output.tif,ushort still doesn’t quite save a 32bit float tiff image how I would see it if I opened it up in GIMP or RawTherapee. Any help there would be great too!

Something wrong with the PNG. I cannot open it with GIMP, G’MIC or ImageMagick.


FYI, G’MIC plugin based filters expect [0,255] range and sRGB (regular or linear) colour space. Many apps expect float images to be in [0,1].

Go figure… Here you go!

The PNG might be weird because it’s a screenshot from VLC.