Importing 16,777,216

Hi I’m a beginner and would like to know if it’s possible/how to import this image:
http://www.brucelindbloom.com/index.html?RGB16Million.html

without losing a single color and preserve all colors on export as .cube (256x256x256) in darktable ?

In the link it offers downloading:

Click here for a ZIP download (53K)
Which I did:

From the above crop, I imagine that the TIFF can then be loaded into dt …

… as to “on export” (from dt) I can’t help, sorry.

1 Like

Do I have to change anything in the import settings before importing the tiff or the png version in order to make sure colors are not quantized ?

If you’re asking me, I don’t use dt, so can’t help with that, sorry.

But the image is 8-bit, so I’m not sure what would get quantized …

DT should open the image as expected. Try it and if it misbehaves let the forum know.

You might have a bad time with this particular image:

It is not tagged with any profile. This image may be useful for investigating the effects that image processing or color transformations have on the number of colors in an image.

Emphasis mine.

darktable expects a color profile. If you’re trying to export a cube file, I assume you’re trying to make a LUT. darktable won’t export a cube file. It’ll export a tiff, but it’ll be hard to not have some gamut compression from the output file.

Doesn’t have to be this image can be this one instead


But what do you mean by darktable won’t export .cube?
I have read here that it’s the only software that supports 256x256x256 cubes…

I have been searching the internet for days and the best I could find is affinity photo which maxes out at 126x126x126 on export

There is no cube export for darktable. You can export a tiff and then somehow turn that into a cube file maybe.

Darktable can use a cube lut in its 3dlut module.

But it isn’t clear what you’re trying to achieve

I’m trying to find any way to import and export 16,777,216 colors in .cube and .png so far no set of tools can do that

I believe that was a problem 10 years ago can’t believe this is still hard to achieve

What good is that going to do you? A cube doesn’t show much change above 48x48x48.

It’s just a part of a research and potentially a project

  • Using a .cube file for storing 2^24 colors is not specially a good idea, because .cube files are stored in ASCII with floating point values between [0,1] (so with potential quantization/rounding errors, and huge file size). But you can still do it with G’MIC:
$ gmic 256,256,256,3,[x,y,z] -o all_colors.cube 

(generating the .cube file takes a few seconds, it outputs a approx. 950 Mo file!).

  • Generating a corresponding HaldCLUT (in .png) is better:
$ gmic 256,256,256,3,[x,y,z] -clut2hald -o all_colors.png

It generates this file:

When re-reading those cluts (at least with G’MIC), there are identical and have the correct number of different colors:

$ gmic all_colors.cube all_colors.png count_colors , e \"Number of colors : \"\$\{\}
[gmic]./ Start G'MIC interpreter (v.3.5.1).
[gmic]./ Input CLUT from file 'all_colors.cube' (1 image 256x256x256x3).
[gmic]./ Input file 'all_colors.png' at position 1 (1 image 4096x4096x1x3).
[gmic]./ Count number of distinct colors in images [0,1].
Number of colors : 16777216,16777216           

One year ago, I wrote a quite fun script that generates a 4096x4096 structured image where all colors are used only once, so with 16.777.216 colors: https://www.reddit.com/r/generative/comments/1903q11/4096x4096_image_that_contains_all_the_existing/

4 Likes

But why do you want to use darktable for this? Its main purpose is the editing of (raw) images. And editing means changing pixel values.

3 Likes

It is if you limit your toolbox to tools that are inappropriate for the task. G’MIC is a more appropriate tool for your purpose than darktable.

3 Likes

I didn’t know about gmic thank you

Is there a way to generate the PNG LUT but with different tiling than HALDs
Like for example 128x128 sized tiles instead of the common 256xy and at increased number of tiles to get the same 16,777,216 colors

Yes, it should be doable.
Not sure exactly what you are looking for, but there are a few examples:

$ gmic 256,256,256,3,[x,y,z] -split z -append_tiles , -o all256.png

creates this .png with 256x256 tiles:

If you prefer 128x128 tiles (one possibility, as there are multiple way of ordering 128x128 blocks):

$ gmic 256,256,256,3,[x,y,z] -split_tiles -128,-128 -split z -append_tiles , -o all128.png

This generates this:

G’MIC is quite versatile and can rearrange pixels quite easily.

1 Like

You can even generate random reordering of blocks, here with 64x64 blocks.
Not sure if it can be useful though (but it’s kinda pretty).

$ gmic 256,256,256,3,[x,y,z] -split_tiles -64,-64 -split z -sort_list +,u -append_tiles , -o all64_rand.png

2 Likes

that is very impressive thank you i will try everything in g’mic now

1 Like