Creating a palette in G'mic

Well it took me ages but finally I can create a palette in Gimp without issue, and Im running tests with some success at calibrating my laser to burn an optimal grayscale index on natural slate.

I read that G’mic algorithms could do a better job but I fail to find exactly where to create a Palette. I searched under all filters but couldn’t recognise any associated. Ai told me the new version may have changed the name or location.

Any help would be appreciated.

What is it that you want to do? A palette is a series of colors.

Suggested commands to create a palette from a image:

  1. colormap has documentation
  2. rep_colormap is extended version of David_Tschumperle’s colormap.
  3. rep_uniq_cols finds all unique color and can be used to add a histogram in it.

For very large images, I would highly recommend last two. They do have a underlying algorithm that is essentially faster for much larger image.

Hi Reptorian

The laser has a power output of (0 to 100%). I create an array of 255 squares (10mm) and fill each square with a Greyscale or Dither of each power level.

I then select the most discernable tones on the lasered material and create a palette on screen with their associated #values (The laser software power output is related to colour values in the image) . The trick is to have enough tones to recreate an image that is of suitable quality…from silhouette to photograph).

Any given material has its limitations and I am working with slate which is binary (Mark/No mark and mark intensity). With incorect settings four tones could be crushed into one…posterisation/banding/clipping.

Like in Raw-Play, laser users adjust settings to achieve a desirable outcome.

I have read through the PDF for G’mic and asked Ai but still cannot see a workflow to create a palette. I know it is ultimately simplex but the terminology is as yet unfamiliar to me.
For example, the Coloured (palette) square in the ‘Indexed colour conversion’ window of Gimp that expands the selection of palettes to apply. I had not thought to click on that as it looked like a representation of an already selected palette and I was more focused on the other selectable buttons and the palette list at the right hand side of the screen.

Eventually I clicked on it out of curiosity and I then had no problem organising a workflow after repeating the process a few times.

The upside is, as seems to be with all UI’s, mistakes and experiments bring much familiarity and learning.

If you want 255 colors, then $ image.png to_gray colormap 255,1,1 will do as well as $ image.png to_gray rep_colormap 255,0,1,1. Both are slightly difference, but second one is more accurate. If you want dither, hmm, I suppose you can append s x foreach { r 20,20,1,1,0 (0,255) index.. .,1,1 rm. } a x. Also, note that this is for G’MIC cli. There is custom code in G’MIC-QT.

So for custom code:

to_gray colormap 255,1,1
s x foreach { r 20,20,1,1,0 (0,255) index.. .,1,1 rm. } a x
to_gray rep_colormap 255,0,1,1
s x foreach { r 20,20,1,1,0 (0,255) index.. .,1,1 rm. } a x

Thanks Reptorian
I actually got on pretty well with Gimp today. I had been informed I would get no more than 5 to 6 tones from the slate but I’ve got 16 so far with possibly more to come. I’ve read that 32 is the avg for human eyesight.

Just a little test image 120mm wide but I’m looking to upscale to 560mmW

I’m on another exploration now to see if I can selectively swap out pixel/area colour values with values that will lase at much higher power and ‘theoretically’ burn the slate particles and bring some light brown to bronze colouring into the image.

1 Like

You’re looking for something like this?

$ 32,32x255 f k/(l-1) (0,1) index[^-1] .,1 rm. f. 1 repeat 16 { a[$>-{min(l-1,$>+15)}] x } a y

That’s 255 levels. Though it’s not uniform. There’s a clear bias. I’ll have to refer to @David_Tschumperle to see what can be done.

This was lasered previously:-


Its just a quick phone photo for refrence so the quality isn’t good but the #value of the material itself is around #30, its usable from there to ~#
175 and a washout up to the last high values for highlights.
I’ve chosen a difficult material and wood or anodised aluminium would be more consistant but the slate has a certain quality the others don’t.

Thanks for the input.

Is that code written in ‘J’

It’s written in G’MIC.

1 Like

Now, I see what you’re looking for. Is this the result you want?

$ 256,256x256 f "u<(k/(l-1))" repeat 16 { a[$>-{$>+15}] x } a y rescale2d 25%,,5

I don’t think you can tell much of a difference between 0-15 or 16-31 or 32-47.

With ^.5 modification, I can actually the difference here:

I think your best best for your work is to use something on the line of that. Still hard to tell. Or use 32 shades:

I’d pick 32 shades.

You can convert images to 32 shades like this and use whatever you use to stipple:

$ sp cat to_gray 32,1,1,1,(x/(w-1))*255 index.. . rm.

Reptorian
Thank you for your suggestions and the code, I’ll try to get that into G’mic this evening, I might even have a try at learning how to create some code .myself. I haven’t programmed anything since Binary and Basic back around the early 1980’s.

Do you know of any beginner introduction to coding for G’mic. I am planning my first photo shoot with the nikon for next month at a road racing event for motorbikes so I have to learn a bit more than the On button and Auto mode, but after that I might have time to learn to code.

As for now, I did some more experimenting today and am confident this palette work will produce some good results. The 32 palette you suggested will work well when the images are lasered full size (360mm x 560mm) because the crushed areas will be much bigger and more tone variation will be less obvious/distracting.
However I will continue to experiment with methods that produce over-burning of the material in precise locations, such as the banding at the side of the wheels (Mud splash) or parts of the landscape.

Thank you once again for your serendipitous reply to my original post.

Regards

The canonical place to start coding in G’MIC is in here:

https://gmic.eu/tutorial/
1 Like