ImageMagick: Apply Hald CLUT at a specific percentage

ImageMagick makes it possible to apply a Hald CLUT preset to an image:

convert photo.jpg hald-clut.png -hald-clut result.jpg

But is there a way to apply a Hald CLUT at a specific strength (say, 50%)?

Thanks!

Kind regards,
Dmitri

1 Like

If you have IM v7, I suggest using magick instead of convert.

The -hald-clut operation doesn’t have a parameter for the amount of the effect. But you can do that with a blend. I suggest two methods (Windows BAT syntax). Suppose you want to process toes.png with the hald file h.png, at 20% strength.

  1. Blend the given hald-clut with an identity hald-clut, making a new hald-clut with the desired strength. Then apply this hald-clut on your image.
magick ^
  hald:8 h.png ^
  -define compose:args=20 -compose blend -composite ^
  toes.png ^
  +swap ^
  -hald-clut ^
  out1.png
  1. Apply the hald-clut on a clone of your image, then blend the result with your original image.
magick ^
  toes.png ^
  ( +clone ^
    h.png ^
    -hald-clut ^
  ) ^
  -define compose:args=20 -compose blend -composite ^
  out2.png

If the hald-clut is smaller than your image, method (1) will be fastest, especially if you want to apply the same hald-clut at the same strength to many images.

For bash syntax, change ^ to \, and escape the parentheses \( and \).

3 Likes

Good stuff! Thank you very much!

1 Like