G'MIC Challenge: Create image from photographs with a single line

Pretty cool stull, Reptorian; didn’t know you can do TSP artwork in G’MIC… If you created the preset, hope you share it in your G’MIC plugin preset. Now if someone could do a variable density Hilbert curve render (posted request below). lol :slight_smile:

OK, Reptorian. Because I have no clue how you did this in G’MIC, I had to use tools that I know of to do so. :slight_smile:

1 Like

If I read correctly, I don’t think Rep has a solution yet; hence the challenge. Yours is different in that I don’t think there is overlap of the path.

Yeah; we had a thread on Traveling Salesman (well Sales person) at GIMPChat a while back. Still have to tools (and at least a good memory for how to use them), afre. lol

:slight_smile:

ref: Human Skulls – 54 Free Images | Media Militia

Expand below for SVG output:

Summary

media_militia_skulls_001

Picked a skull from Media Militia’s site and extracted it on white background and did some additional magic before feeding it into Voronoi Stippler and then that result into TSP script. Then I smoothed the path some before stroking the path. Just a bit more fun before I hit the hay for another 10 hour tomorrow (well later today). lol

:slight_smile:

1 Like

TSP was added to gmic a while ago with command tsp - mentioned here:

Should have known the G’MIC team would have done so by now, GC. lol

Need to see if it’s available within the GIMP plugin itself since I don’t CLI. :slight_smile:

Voronai Stippling sounds like a cool idea for G’MIC. @David_Tschumperle : Is modifying Voronai is feasible? In addition, it would be nice to have just the coordinates of vertexs as a image instead of points.

Oh, feathers. A frivolous way to burn off a Sunday morning, with bagels and a smear of cream cheese.

foo:
   sp portrait2,1024
   +r2dx. 25%,5
   luminance.
   apply_curve. 1,0,0,90,0,160,255,255,255
   n. 0,1
   oneminus.
   noise. 0.4
   threshold. 65%
   pointcloud. 3
   channels. 0,1
   *. 4
   tsp. ,
   permute. cyzx
   nm. points
   i 1024,1024,1,1
   nm. canvas
   eval {V=crop(#$points);polygon(#$canvas,-size(V)/2,V,1,0xffffffff,255)}
   keep[0,-1]

And then:

gmic foo.gmic foo orig.png tsp.png

Traveling salesman version:

Feeding ~4K – ~7K of points to ‘tsp’ probably shouldn’t be done on @afre 's celebrated laptop…

2 Likes

@grosgood
Thank you for this script using ‘tsp’.

2 Likes

Really cool, grosgood; great result too, samj. Hopefully the code will run in G’MIC GIMP plugin. :slight_smile:

Theirs is a deconstruction of both rep’s and yours. Ha ha.

Just tried; no dice. I guess to use TSP in G’MIC, you have to go CLI. lol

:slight_smile:

So, it doesn’t work from the custom command filter? I can’t try because

Hope grosgood doesn’t mind the play. Anyway, sometimes you just have to stick with the devil you know. I did have to reighn in on dot (used Inkscape for that). lol

Kept it as a vector. :slight_smile:

Untitled

1 Like

Meant “one” not “on”. lolol

Also, used 24K dots. :slight_smile:

Using the TSP tools and batch files, still only took 10s of seconds on my old dilapidated 2014 vintage PC, afre. Of course my new toy finishes 3 times quicker. lol

:slight_smile:

I couldn’t get it to work in custom command either. I wonder if whirl drawing and thin lines could be somehow put together for this.

Actually not much slower on a Dell Latitude E6430 2-core (4 threads):

$ uname -a 
Linux gwen 5.15.16-gentoo-gwen #1 SMP Tue Feb 1 15:14:04 EST 2022 x86_64 Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz GenuineIntel GNU/Linux

Runs were maybe only 25% or 30% longer on this bedside-browsing laptop than the dual Xeon playpen I typically use. Methinks there is not a lot in my implementation that takes advantage of a large core count. Credit where credit is due: @David_Tschumperle for implementing TSP and @garagecoder for the pointer that piqued my interest and sent me off into the weeds for recreational coding. And, of course, @Reptorian for throwing the gauntlet down.

Not hard to wrap this up for gmic-qt insofar as mechanics go; but my reluctance stems from the sensitivity this particular implementation has to its input: it is a bit tedious, those of you with a CLI bend can easily see what I mean by fiddling with the curve-and-noise bits. Real design work needs to be applied here. I like plug-ins that (a) don’t have a bazillion controls (3 - 5 is about right) and (b) more-or-less gravitate to interesting results on their own without a lot of tweaking. This toy is a bit temperamental for that. It likes large areas of light and dark, without a lot variation in either. I, for one, would like this toy to render more interesting results over a wider range of inputs. Don’t see many time-slices for me to actually do that design. It has been a busy six months for me, alas, and the Spring looks crowded already. And there are large swaths of tutorial writing I’m keen on doing.
Perhaps next weekend I can wrap it, as is, for gmic-qt and throw it in the ever-growing testing bin. Perhaps @lylejk or others can then suggest in what directions improvements should go, so that in the future it can be made to be fun without a lot of tedious adjustment.

Some hints to get better results (at least using the TSP batch files) is to first extracted the subject and placed on white background, then added contrast to you target image. I usually use a blending of G’MIC Painting preset set to lighten and adjust opacity to taste. It’s what I did to your image. Below’s roughly the result I used (see some flaws on this one since I did this quickly; lol) to feed into my voronoi batch file. Gary. :slight_smile: