Digital Lith Case Studies Lut Generator

Digital Lith Case Studies Lut Generator
Published: Mon, February 17th 2020

Originally published Sun, February 17th 2019

Although I announced in the last episode, that this time we work in the other direction of bromide/sulfite, I decided to postpone that to the next episode. In this episode I want to spend a bit of time about coloring and about color lookup tables (LUT) in particular.

For the first three episodes we used a LUT that I provided. But instead of using that one, today you are going to create your own one.

The best way to create a LUT is to use colors that you read out of a real lith print - or a scan of a real lith print because that is easier. If you happen to have such a scan at hand - good for you. Or bad because you seem to be in the same situation like me without access to a darkroom anymore. Otherwise you would not use DigitalLith if you can have the real thing. If you do not have a scanned lith print at hand - well there are scanned lith prints which you can find on the internet. I do not want to take others lith prints so let us use one of my own scanned lith prints. If you read the about page you know that I do have another site where I show my pinhole photography and there you can find quite a few scans of real lith prints. Let us start with this one: Click!

What you need to do is to make a screenshot or better save the image on your computer. There is no method in place which tries to prevent you from doing so.

Once you have the image, open it in an image editor which lets you read out color values. Most people might use Photoshop for this. But there are also other good editors out there. I for example used Affinity Photo to read the color values.

Anyway, use the image editor of choice and load the image. You also need a text editor. And I mean a simple text editor, not Microsoft Word or OpenOffice and the like. We just need to create plain text.

For the LUT definition we enter the number of color values in the first line. Let us go with a value of 2000. That means our lookup table will cover a mapping of 2000 gray values to colors. Black is value 0, bright white will be 1999.

Here I marked the places where I am going to pickup the color values:

IMAGE

The value I picked you can see here:

2000
0, 12, 1, 7
200, 40, 31, 16
500, 60, 49, 17
800, 117, 96, 41
1200, 182, 128, 64
1600, 222, 171, 90
1850, 247, 230, 184
1999, 255, 245, 209

The above describes how the values that you picked up distribute over the range of 2000 gray tones. Let us look at the first line, the 0 means that pure black is assigned to an RGB value of 12 (R), 1 (G) and 7 (B). The next line says that gray value of 200 is assigned to 40 (R), 31 (G) and 16 (B) and so on until we reach pure white (gray value of 1999) which is assigned to 255 (R), 245 (G) and 209 (B).

OK, the next you have to do is to download the lookup table generator jar file and store it somewhere on your disk. And – unfortunately – you will have to install Java in a version 10 or greater and need to know how to work from the command line. Here I provide the instructions for Linux or Unix. On Windows usage is similar but the path name separator is different.

Let us assume for simplicity that you have stored the above text file as CaseStudiesLut.data in the same directory that you have placed the lutgenerator.jar file.

We are going to create multiple LUTs. But first let us see what happens if we call the generator without options:

ruediger> java -jar lutgenerator.java
Missing the following mandatory options: -lut, -lutdef
LutGenerator [-help] [-distribute=(LAB|MULT|ADD|GIVEN)] [-lab] [-gradient=<gradient>] -lutdef=<input lut definition file> -lut=<output lut file>
ruediger>

So you see it gives a short usage message. What you need to provide is at least the LUT definition and the name of the LUT file which will get created.

Then you can also specify the method used to create the distribution of the colors on the gray scale. The default is to use the given gray values. But then you can also specify to take the lightness value of the color converted into Lab color mode. Or the values are distributed according to the sum or product of the RGB values.

Let us first create a LUT with the given gray values:

ruediger> java -jar lutgenerator.jar -lutdef=CaseStudiesLut.data -lut=CaseStudiesGiven.lut
Read data from file: CaseStudiesLut.data ...
Compute LUT ...
Write LUT to file: CaseStudiesGiven.lut ...
Done.
ruediger>

And next let us distrubute the colors by their LAB values:

ruediger> java -jar lutgenerator.jar -lutdef=CaseStudiesLut.data -lut=CaseStudiesLab.lut -distribute=LAB
Read data from file: CaseStudiesLut.data ...
Compute LUT ...
Write LUT to file: CaseStudiesLab.lut ...
Done.
ruediger>

Now we have created two files

ruediger> ls -l
total 616
-rw-r--r--  1 ruediger  staff     190 17 Feb 11:54 CaseStudiesGiven.lut
-rw-r--r--  1 ruediger  staff     190 17 Feb 11:57 CaseStudiesLab.lut
-rw-r--r--  1 ruediger  staff     144 17 Feb 11:46 CaseStudiesLut.data
-rw-r--r--@ 1 ruediger  staff  299378 17 Feb 11:45 lutgenerator.jar
ruediger>

The generated LUT files are pretty small. Let us have a look at the contents:

ruediger> cat CaseStudiesLab.lut
# Generated LUT definition
{"lutSize":2000,"dataPoints":[[0,12,1,7],[238,40,31,16],[419,60,49,17],[855,117,96,41],[1192,182,128,64],[1521,222,171,90],[1900,247,230,184],[1999,255,245,209]]}
ruediger>

As you can see above, values at the start and the end of the scale are preserved (0→[12,1,7] and 1999→[255,245,209]) but the values in-between have a different gray value computed from the Lab of the given RGB values. But hey, if we look closer, we have not been too much off. I call this an accident, because normally the differences between what I think the gray value would be and what the lightness of the color really is are way bigger.

You can see the images at the bottom of this post. But let us first create two more LUTs with the ADD and MULT distribution method. And two with the gradient set to 2 and 0.5. We will see what this means in a second.

ruediger> java -jar lutgenerator.jar -lutdef=CaseStudiesLut.data -lut=CaseStudiesAdd.lut -distribute=ADD
Read data from file: CaseStudiesLut.data ...
Compute LUT ...
Write LUT to file: CaseStudiesAdd.lut ...
Done.
ruediger> java -jar lutgenerator.jar -lutdef=CaseStudiesLut.data -lut=CaseStudiesMult.lut -distribute=MULT
Read data from file: CaseStudiesLut.data ...
Compute LUT ...
Write LUT to file: CaseStudiesMult.lut ...
Done.
ruediger> java -jar lutgenerator.jar -lutdef=CaseStudiesLut.data -lut=CaseStudiesLabG2.lut -distribute=LAB -gradient=2
Read data from file: CaseStudiesLut.data ...
Compute LUT ...
Write LUT to file: CaseStudiesLabG2.lut ...
Done.
ruediger> java -jar lutgenerator.jar -lutdef=CaseStudiesLut.data -lut=CaseStudiesLabG0.5.lut -distribute=LAB -gradient=0.5
Read data from file: CaseStudiesLut.data ...
Compute LUT ...
Write LUT to file: CaseStudiesLabG0.5.lut ...
Done.
ruediger> ls -l
total 648
-rw-r--r--  1 ruediger  staff     190 17 Feb 12:53 CaseStudiesAdd.lut
-rw-r--r--  1 ruediger  staff     190 17 Feb 11:54 CaseStudiesGiven.lut
-rw-r--r--  1 ruediger  staff     190 17 Feb 11:57 CaseStudiesLab.lut
-rw-r--r--  1 ruediger  staff     191 17 Feb 12:54 CaseStudiesLabG0.5.lut
-rw-r--r--  1 ruediger  staff     187 17 Feb 12:54 CaseStudiesLabG2.lut
-rw-r--r--  1 ruediger  staff     144 17 Feb 11:46 CaseStudiesLut.data
-rw-r--r--  1 ruediger  staff     183 17 Feb 12:53 CaseStudiesMult.lut
-rw-r--r--@ 1 ruediger  staff  299378 17 Feb 11:45 lutgenerator.jar
ruediger>

If you copy those generated LUT files to the lookup table directory and then run a test development you can see the effect of each lookup table by selecting them in the coloring section of the parameters. The coloring will get applied to the current test development. But also watch at the color gradient shown. You will realize that ADD compared to LAB will move the gradient towards the lighter tones and MULT will do so even more.

You get much more control over this by using the gradient parameter which is by default at one. A value greater than 1 will move to the lighter tones, a value lower than one (but bigger than zero) will move to the darker tones. I happen to use most of the time just distribution method LAB and leave everything as is.

OK, there is one thing that we have not yet talked about. Instead of giving the RGB values, you can also provide Lab values. For those you give the gray value as first as above, then the lightness value in the range of [0,100] and then a and b in the range of [-100, 100]. With such a data file run the generator with parameter -lab which indicates that Lab values are provided and not RGB.

Below you see the results. I took an image I made in Notre Dame de Paris and used parameters which are not generating that much grain as in the last episodes. From top left to bottom right these are done with:

  • distribute=GIVEN
  • distribute=LAB
  • distribute=ADD
  • distribute=MULT
  • distribute=LAB, gradient=0.5
  • distribute=LAB, gradient=2