float2int8 copies picture 3 times in one image

Hello all

This is just a question for my understanding what float2int8 really means. According to the documentation, it “Convert selected float-valued images to 8bits integer representations.”
So if we do something like
gmic textimage2d 512 float2int8 display
you’ll see the test picture 3 times stacked in one image. It is not the problem that float2int8 does “nothing” with the picture. In fact it does something. If you use it with a picture which has more depth values than int8 (e.g. a raw picture out of a digital camera), you’ll see 3 different pictures (See the uploaded example picture). So just for my understanding:

  • Does this command work as expected? I expected one picture, not 3 stacked pictures.
  • If it is as expected: What is the meaning of the other two? And why aren’t they separated to 3 separate images but all together in one image?

1 Like

This command has been made to be able to edit float-valued images (typically resulting from FFT) in software that does only manage 8bit-integer encoded image (GIMP 2.8).
What it does is encode each input float value as a 24bits precision decimal number, i.e as a 3x8 bits per pixel value. The resulting image is only integer valued and looks like what you mention, i.e. 3 copies of the same kind of image information along the vertical axis.
You can then save it as a .png file for instance, and reconstruct the original float pixels using int82float.

I don’t think these two commands are really useful when working from the command line, as the CLI interface manages float-valued images out-of-the-box, and can load/save them with appropriate formats (.tiff being a good one).

1 Like

Thanks. So that explains a lot. I see the idea behind.
In fact I’m using that through the C interface and so it’s really good to know that.

I would recommend to add something to the documentation about that behavior.

Happy new 2018. :wink: