And, less than basically (more than basically?) essential background for gimp-gmic filter users venturing for the first time into the strange and wonderful world of the gmic command line.
- Introduction to the G'MIC image which discusses in a general way how G'MIC represents images; it is quite different from Gimp's representation, so the matter of data conversion is ever-present between Gimp and G'MIC.
- Images as Datasets specifically goes into the calamity you experienced; the example there actually illustrates the problem you had.
- Dinasset's Tips and Curiosities Very practical, hard-earned pointers from one fellow who leaves the safe harbor of Gimp-G'MIC filters from time to time and ventures out onto the high seas of the command language.
- Normalize is the tutorial on using this -n 0,255 command.
The particular problem you observe stems from an inappropriate data conversion. the gmic command line devotes four time the number of bits to a value stored in a pixel channel than does Gimp, allowing for very high precision calculations within G'MIC with very little loss stemming from rounding error. Technically, gmic harnesses 32 bits-per-value floating point formatted numbers, Gimp harnesses only 8 bit unsigned integers (unless you use the GEGL parts). When you employ the Gimp-G'MIC plug in and the filters it hosts, that framework handles the matter of data conversion for you. It is akin to using an automatic transmission in an automobile. When you use the gmic command line yourself, you are outside of that framework and are obliged to be more conscientious in the matter of data management. You are driving a car with a manual transmission; you have to use the clutch and shift gears yourself. Ronounours gave you the essential command to "clutch and shift gears"
-n 0,255 which commands G'MIC to reformat the data stored in pixel channels from 32 bit floating point to 8 bit unsigned integers. That involves data loss, by the way, so gmic expects to be told; it won't carry out destruction of information without your permission.
It is fair to ask why isn't such a data conversion always automatic? Well, generally, G'MIC lives a large and contented life outside of Gimp, where automatic conversions from high-to-low formats would annoy people who require high precision image representations. Normalization becomes a frequent necessity only where G'MIC's path crosses those of eight-bit paint programs. One of the reasons the Gimp-G'MIC plug-in came into existence was so that people could make use of scripts written in the gmic command language without having to worry about data conversion. Having ventured outside of that cloister, you'll have access to the full power of the underlying gmic command language, but it does require a more astute awareness of the format of your image data, and what format you might want it to be in.
It won't be long before data awareness will become second nature to you, and you'll invoke commands like -normalize and -cut without thinking much about them. This is probably the biggest hurdle that people new to the command line tool have to leap. Well, now you know the height and breadth of the thing and you'll be over it in no time. Welcome to the command line tool.
Garry