OK, so after quick investigation, that is what I thought :
This LUT contains out-of-bounds values (not in range [0,1]), whicn means that when you apply it on a sRGB image, you end up with an image that has also out-of-bounds values.
Basically;
$ gmic sp colorful Hard.cube map_clut.. .
[gmic]./ Start G'MIC interpreter (v.3.3.3).
[gmic]./ Input sample image 'colorful' (1 image 800x800x1x3).
[gmic]./ Input CLUT from file 'Hard.cube' (1 image 16x16x16x3).
[gmic]./ Map color LUT . on image [0].
[gmic]./ Display images [0,1] = 'colorful, Hard.cube'.
[0] = 'colorful':
size = (800,800,1,3) [7500 Kio of float32].
data = (13.8492,-19.7799,-99.2392,-95.8161,-95.8161,-85.1882,-19.7799,13.0144,11.9683,13.0144,13.0144,-85.1882,-95.8161,-99.2392,-99.2392,-99.2392,-95.8161,-95.8161,-95.8161,-95.8161,-95.8161,-95.8161,-95.8161,-95.8161,-99.2392,-99.2392,-99.2392,-85.1882,-99.2392,-99.2392,-99.2392,-99.2392,-99.2392,-99.2392,-95.8161,-95.8161,-95.8161,-99.2392,-19.7799,-91.5903,-95.8161,-99.2392,-85.1882,-85.1882,-85.1882,-99.2392,-95.8161,-99.2392,-99.2392,-99.2392,-95.8161,-64.3068,-64.3068,-85.1882,-99.2392,-85.1882,-85.1882,-64.3068,-64.3068,-99.2392,-95.8161,-99.2392,-85.1882,-100.699, ... ,-20.4432,-20.4432,-20.4432,-20.4432,-20.4432,-20.4432,-20.4432,-16.2401,-20.4432,-6.27372,-20.4432,-20.4432,-20.4432,-20.4432,-16.2401,-6.27372,-6.27372,-20.4432,-6.27372,-6.27372,-6.27372,-20.4432,-20.4432,-20.4432,-20.4432,-20.4432,-20.4432,-16.2401,-16.2401,-16.2401,-95.3952,-95.3952,-95.3952,-95.3952,-95.3952,-95.3952,-95.3952,-95.3952,-16.2401,-95.3952,-95.3952,-95.3952,-95.3952,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024,-91.2024).
min = -138.993, max = 348.724, mean = 84.8826, std = 112.177, coords_min = (684,0,0,0), coords_max = (777,33,0,2).
[1] = 'Hard.cube':
size = (16,16,16,3) [48 Kio of float32].
data = (-24.8791,-25.183,-20.7968,-21.3053,-26.8329,17.7911,30.7933,55.4495,80.757,102.814,111.081,119.551,123.261,124.094,132.431,160.014;-25.1647,-25.2154,-20.0371,-22.5869,-29.4905,13.6512,27.5214,55.7792,79.5156,102.074,110.949,118.781,123.184,124.07,132.057,159.837;7.87874,-10.1699,-11.8756,-26.0868,-27.1715,16.5459,28.2203,58.3052,84.3015,104.616,116.385,120.355,123.761,125.642,134.033,160.733;-30.4954,-22.8444,-11.5795,17.2097,-7.70788,19.2377,37.8649,69.716,98.0664,114.223,123.907,125.751,127.94,130.773,136.308,163.958, ... ,211.557,211.445,212.42,211.413,210.288,211.791,216.795,223.799,235.197,245.319,251.503,251.484,245.105,251.977,253.753,259.47;225.232,225.277,225.323,224.974,223.319,226.278,229.668,237.438,247.727,253.605,256.475,257.943,256.541,246.339,254.578,262.357;241.926,241.684,242.415,241.82,241.765,242.101,246.058,251.55,255.071,261.313,265.149,266.491,266.861,264.042,258.95,269.244;267.941,267.922,268.266,268.227,268.306,268.965,270.577,273.511,276.892,279.627,281.513,282.74,284.293,286.095,289.008,297.345).
min = -228.822, max = 352.56, mean = 151.026, std = 120.036, coords_min = (4,0,3,0), coords_max = (15,15,14,2).
[gmic]./ End G'MIC interpreter.
Look at the min/max values you get for images [0]
and [1]
, it’s definitely not [0,255]
.
So, by chance (for you), ffmpeg
did the value clamp automatically, which may be good for video frames, but not that good for general images, when you may want to keep those unbounded values visibles.
You can easily clamp your result as well in G’MIC, with adding cut 0,255
before saving the image.
$ gmic sp colorful Hard.cube map_clut.. . k.. c 0,255 o output.jpg
and you should get something very close to what ffmpeg
does (assuming it indeed clamps the values as I think it does).