Interpreting the output of gmic -print


(clepsydrae) #1

Hi – I do “gmic -p” on a .png image and see included in the results:

size = (8192,8192,1,3) [768 Mio of floats].

…what is the meaning of “Mio of floats”? Is it reporting the number of 32bit float values once the (8bit integer) image has been converted internally?

Is there a way to show the bit depth (and int/float type) of an image using gmic?

Thanks!


#2

I think “Mio” is short for “mébioctet” - a french equivalent of mebibyte/MiB = 2^20. That does work out as follows:

(8192 * 8192 * 1 * 3 * 4) / (2^20) = 768

where the 4 is from 4 bytes per “pixel”.


(clepsydrae) #3

Thanks! Yeah, I saw that alignment which is why I asked – is that the “internal pipeline” size, then?


#4

Hmm I’m not certain I understand your question, so I’ll state what I know: the stats displayed are width, height, depth, channels. 32-bit float is the default data type. If you define a new image with:

gmic 800,800,1,3

that will imply 800 * 800 * 1 * 3 * 4 bytes (32bit = 4 bytes per pixel per channel). For a three channel 2D image that means each vector valued pixel occupies 3 * 4 = 12 bytes (you can have arbitrary number of channels). The data is stored in memory as complete channels, rather than all bytes of a pixel in turn. For an rgb image it’s in memory as all red pixels, then all green pixels…

Whether other data types can be selected, I think so but @David_Tschumperle can elaborate (it used to require extra compilation steps).


(clepsydrae) #5

32-bit float is the default data type

…that’s what I was looking for, thanks. The docs for gmic say that -print will “Output information on selected images” so I mistsakenly interpreted the “size =” line to be telling me about the data in the file. It sounds like it is instead telling me about the internal processing pipeline, i.e. the number of floats the image represents once it is read into gmic.

Does gmic have a “show me details about the file” function? Or maybe mediainfo is the more appropriate utility for that?


#6

I think other tools like exiftool/dcraw/file etc. are more suited to extracting image file info (gmic displays very little about the file itself, only the resulting data).