Rainbow line / shape

Is there a way to create a rainbow by following a shape?
I imagined doing it on the line and then applying a solidify.
The idea is that you always apply it in the same direction and in several ways at the same time.

I made the image by hand, it should be a complete rainbow around the figure

‘Gradient RGB’ might be a starting place.

1 Like

Back’s hurting. Here are my immediate thoughts.
1 Create a mask of closed objects.
2a Fill a rectangle that encompasses the objects and fill it with a 2d rainbow gradient.
2b May require an origin and terminal points and rotation.
3 Mask, etc.

2 Likes

result

invert + skeleton + BG mask + Gradient RGB + BG mask + solidify
It is a good approximate
thank you

Not convinced but as a first try… okay I guess…

You can certainly make psychedelic candy bars out of this design. :joy_cat:

It doesn’t convince me either, but it’s something.
I’m trying to recreate a texture fluid mask for ebsynth
So the texture doesn’t imagine too many random variations.


Although in their last paper they changed this for a random grid of spots in recognizably similar places using “patchmatch”

Skeleton might not be the best choice. Something with builtin ML functions like OpenCV would be more useful here. Detect object or group of objects, make outline generate boundaries and fill them in together or separately.

Didn’t this early thread answered the problem? warp without triangles

I think that it might be nice to have a multiple object version of that command.

That ended up solving it with torch-warp, it did not work with g’mic :frowning:
But the fluidity of the texture is usually very good so I thought about adding a reinforcement similar to the “face in opencv”

@bazza - I think I may have found the solution to your problem. Try converting this to G’MIC-QT and there is a source code over there - https://forums.getpaint.net/topic/28298-trs-paste-warp/

1 Like

It is true, with a black background and a white figure, the “Gradient RGB’” works better.
Thus, the only problem would be how to keep the colors in the similar direction, if the figure rotates: /

IIRC in the gradient RGB output direction is related to hue, so you just need to do a hue rotation to match the object rotation (I think)

1 Like

I have a better idea

512,512,1,1
-fill[-1] 180+(atan((0.5-(x/w))/(0.5-(y/h))))/pi*360
100%,100%,1,1,1
100%,100%,1,1,1
-append[-1,-2,-3] c
-hsv2rgb[-1]

That produces this:

rainbow2

which is not quite what you want but it should give you another direction to investigate.

I had another idea. It’s not quite perfect because it leaves a hole.

-channels 0
-gt 0

--l
#break shape
100%,100%,1,1,0
set[-1] 1,{0,xM},{0,yM}
-dilate[-1] 3
-sub[0,-1]
-gt[0] 0

# measure distance from end
100%,100%,1,1,0
set[-1] 1,{0,xM},{0,yM}
-replace[0] 0,10000000000
-distance[1] 1,[0],2
-eq[0] 1
--mul
-rm[1]


# make rainbow
[0]
-reverse[0,1]
-n[0] 0,360
-append c
-hsv2rgb
-endl
-n 0,255

rainbow 3

1 Like

Don’t automate it yet, but the result is much better than just masking.

1 Like

If I understand correctly, you are trying to do something like:

  1. Label all the pixels in a source area with a custom colour
  2. Label all the pixels in a destination area with the same pattern of colours
  3. Move the pixels from the source locations to the destination locations

Is that about right?

That sounds like the extended version of the relevant PDN plugin. I might be up for making the gmic version soon.

1 Like

PathMatch/Ebsynth use it as a “guide” to use pieces of the image.