Page 1 of 1

Create new hald clut from image?

Posted: 2019-02-02T09:17:42-07:00
by angsunrey
I have used the cmd line tool to apply hald clut, but would like to derive a new hald clut from an image.

I am new to the process and could use some direction.

Re: Create new hald clut from image?

Posted: 2019-02-02T09:32:58-07:00
by snibgo
The question is vague.

What version of IM do you use?

What do you mean by "derive a new hald clut from an image"? I don't know how just one image might be used to make a hald clut.

Re: Create new hald clut from image?

Posted: 2019-02-02T11:38:13-07:00
by fmw42
The general technique is to create a base HALD image (all colors with no processing applied) using HALD:X. Save as PNG. Take the PNG image to some interactive tool like GIMP or Photoshop. Apply the same processing you want to do to an image to the HALD base image. Then save as a new PNG. Then bring back that new HALD image to Imagemagick and use -hald-clut to apply it to any image.

See https://imagemagick.org/Usage/color_mods/#hald-clut

Re: Create new hald clut from image?

Posted: 2019-02-02T11:54:36-07:00
by snibgo
As Fred says, a known process can be used to make a hald clut. Alternatively, if we have two images where one was made from the other by some unknown process, it may be possible make a hald clut that does the same thing.

But if all we have is a single image, I don't know how we could make a hald clut from that.

Re: Create new hald clut from image?

Posted: 2019-02-02T11:56:47-07:00
by angsunrey
snibgo wrote: 2019-02-02T09:32:58-07:00 The question is vague.

What version of IM do you use?

What do you mean by "derive a new hald clut from an image"? I don't know how just one image might be used to make a hald clut.
Probably vague, because of lack of understanding.
I downloaded ImageMagick 7.0.8 Q8 (64-bit).

I meant how to create a hald clut for reuse based off a modified image. I thought the tool could generate one this way. Now I understand an base identity hald clut must be modified in the same manner as the image using an editing tool

Re: Create new hald clut from image?

Posted: 2019-02-02T11:59:22-07:00
by angsunrey
fmw42 wrote: 2019-02-02T11:38:13-07:00 The general technique is to create a base HALD image (all colors with no processing applied) using HALD:X. Save as PNG. Take the PNG image to some interactive tool like GIMP or Photoshop. Apply the same processing you want to do to an image to the HALD base image. Then save as a new PNG. Then bring back that new HALD image to Imagemagick and use -hald-clut to apply it to any image.

See https://imagemagick.org/Usage/color_mods/#hald-clut
This filled in the gaps for me. Thank you.

If done programmatically, I would just take the same code to modify the image and apply it to the base hald clut.

Re: Create new hald clut from image?

Posted: 2019-02-02T12:00:19-07:00
by angsunrey
snibgo wrote: 2019-02-02T11:54:36-07:00 As Fred says, a known process can be used to make a hald clut. Alternatively, if we have two images where one was made from the other by some unknown process, it may be possible make a hald clut that does the same thing.

But if all we have is a single image, I don't know how we could make a hald clut from that.
I see. So would I be able to use image magick with two images (original and modified by unknown process) and create a hald clut?

Or maybe a better question is, how would I do this?

Re: Create new hald clut from image?

Posted: 2019-02-02T12:09:04-07:00
by snibgo
As I say, it may be possible. But only if every input colour has only one output colour. And if the input image doesn't contain every possible colour, then the hald clut will include guesswork.

Re: Create new hald clut from image?

Posted: 2019-02-02T12:14:11-07:00
by angsunrey
snibgo wrote: 2019-02-02T12:09:04-07:00 As I say, it may be possible. But only if every input colour has only one output colour. And if the input image doesn't contain every possible colour, then the hald clut will include guesswork.
If you know of any learning materials, I am completely ignorant with no available resources. I have definitely come across your site more than once the past few days.

Re: Create new hald clut from image?

Posted: 2019-02-02T12:46:17-07:00
by snibgo
See my pages "Editing with hald cluts" and "Sparse hald cluts". To do what I suggest requires IM to be built with my process modules. This is a fairly advanced technique.

I suggest you start with simpler techniques, eg "gain and bias". The introduction to that page mentions alternatives, and gives links.

If you link to sample images, perhaps we can advise better.