G'MIC Map function question

Curious about the map function, I downloaded the images from this page:
and ran the command as given in the example.

But the output I get (shown below) looks nothing at all like the output that is shown in the example. My question is why not? Thanks.

Looks like the original basin_index_map.png is not present. Sadly the .jpg doesn’t have the correct index values and compression makes it worse.

The basic idea is to show the values of one image become an index into the palette:
gmic 400,400,1,1,y map_palette.png +map.. .,0

Perhaps somebody else has the time to find or even recreate the original .png

The index image is a png. Clicking it to get the larger one - that one’s a jpeg. But perhaps the image that is shown on the page is sufficiently different than the one used to create the output image that the two don’t match at all - but we have no way of knowing that for certain. Not having access to the actual images used to construct the output is only going to confuse folks who attempt to follow along.

Using the png index input and the png palette and outputting to a png yields the following result.


G’MIC has several fractal generators, two of which are called “Newton Fractal”. Generate one with only a few iterations for an input image for the tutorial. Let us know what the output image is and stats are from the log or CLI output.

Yes, definitely something wrong with the source image - looks like a tutorial which needs fixing!

Ping @David_Tschumperle @grosgood.

It looks as though the values are halved in the .png
gmic map_nrmask.png mul 2 map_palette.png map.. .,0

Hi Jim, afre -
Got @afre 's ping.
Looking into it. The example needs updating along with much of it’s ken. Old school command hyphens and such…
But you are not far off. The dynamics look right. Color mapping is off, as @garagecoder observes.
I’ll post an update here in modern notation; have fun in the meantime.
The immediate cause is bit/documentation rot. As @garagecoder observed, and the tutorial notes, the G’MIC map command takes as input an indexed grayscale - perhaps with 256 distinct levels - and assigns colors to each level as dictated by a palette. Back in the day, (2013 or so) the index grayscale input was something called basin_index_map.png, and its index grays were set in a particular way. That image has since become a jpeg, and the lossey conversion has scrambled indexing. Needs to be replaced with the original .png which I have in an archive. Have to haul it out and post it, then update the tutorial.
I mean to update those tutorials as well. Stay tuned…


Hi Garry. Glad to see you around!

I must say the tutorial written by @grosgood has been a blessing for the G’MIC project. Unfortunately, it is a bit outdated now, but one of my plan is to convert all the pages into the new “G’MIC-Markdown” format, to make it directly available in the same format as the reference documentation, and to be able to maintain it more easily over time.

Have to run. Duty calls, but maybe you an I can have a brief PM chat on logistics. I’m fine with markdown. I’d love to have the tutorial bits bought up to current. Bye now…


I’ll send you a PM, of course! So glad to know you’re still around!

basin_index_map.png is the image the tutorial originally had: 1600,1600,1,1

map_palette.png 200,1,1,3 is the original palette file. Seems over the years, that got a little mangled too.
Palette file hard to view? A little G’MIC code can fix that:
gmic map_palette.png expand_y. 15 output map_palette_31y.png
The tutorial code should look more like this now:
gmic basin_index_map.png map_palette.png map.. [-1] remove. resize. 50%,50% output basin_c0.png
And it should yield something like:

Try the default palettes too, such as hot:
gmic basin_index_map.png map. 'hot' resize. 50%,50% output basin_c1.png

@David_Tschumperle has set up a tutorial folder at gmic-community git repository - probably the best outcome of the day. From time to time, I’ll commit refurbished tutorials there. New ones as well. Being the community repository, any and all of you can join in the fun too: adopt a gmic command, wrap a tutorial around it and share the results. There’s more than enough to choose from. Why should I have all the fun?

1 Like