Create new hald clut from image?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
angsunrey
Posts: 5
Joined: 2019-02-02T09:15:43-07:00
Authentication code: 1152

Create new hald clut from image?

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create new hald clut from image?

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Create new hald clut from image?

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create new hald clut from image?

Post 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.
snibgo's IM pages: im.snibgo.com
angsunrey
Posts: 5
Joined: 2019-02-02T09:15:43-07:00
Authentication code: 1152

Re: Create new hald clut from image?

Post 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
angsunrey
Posts: 5
Joined: 2019-02-02T09:15:43-07:00
Authentication code: 1152

Re: Create new hald clut from image?

Post 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.
angsunrey
Posts: 5
Joined: 2019-02-02T09:15:43-07:00
Authentication code: 1152

Re: Create new hald clut from image?

Post 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?
Last edited by angsunrey on 2019-02-02T12:13:45-07:00, edited 2 times in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create new hald clut from image?

Post 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.
snibgo's IM pages: im.snibgo.com
angsunrey
Posts: 5
Joined: 2019-02-02T09:15:43-07:00
Authentication code: 1152

Re: Create new hald clut from image?

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create new hald clut from image?

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply