Playing again with sprite packing

I’m reprogramming from scratch a version of the pack_sprites command, which should be slightly faster. So far, it seems to be working. I’m going to try and slowly replace the old command in the new one, in the G’MIC-Qt filters.

Here are a few examples of how to use this new command (temporarily renamed pack_sprites2 ).

Example 1:

foo :
  l[] { repeat 26 { 0 t. {`_'a'+$>`},0,0,${"font Acme,180"},1,${-RGB},255 } a z,0.5 round autocrop s z }
  1024,1024,1,4
  new_pack_sprites. [0--2],5,50,3,1,5000 k.
  drop_shadow. 3,3,1
  drgba 255
  rs 50%

Example 2:

foo :
  palette hsv rs. 16 s x foreach { ball 64,{^} k. }
  1024,1024,1,4 t. "G'MIC\nRules!",0.5~,0.5~,${"font SundayMilk,512"},1,255 channels. -3,0
  new_pack_sprites. [0--2],10,10,0,0,1000 k.

Example 3:

foo :
  sp colorful,1280
  100%,100%,1,2
  shape_star 48 n. 0,255 r. 100%,100%,1,2
  new_pack_sprites.. .,5,20,2,1 rm.
  channels. 0 !=. 0
  blend shapeaverage0
  rs 50%

3 Likes

What about sprite packing without rotation or scaling and preserve order? I seen these game texture packing.

In the second example the balls are not rotated ( the light comes from the same angle).
But what you describe sounds like a gallery?

Yes. Bin packing is what I’m thinking of. There is an article here: Exploring rectangle packing algorithms . It is something I wanted to explore.

Wow; looks impressive, David. Also, faster is always a good thing. lol

:slight_smile:

Also, as a side note, nearly 2 decades ago I was following Jigsaw Image Mosaics. Have been hooked on packed algorithms (and mosaics) ever since. For those not aware of JIM, below’s a the site for JIM. :slight_smile:

Jigsaw Image Mosaics

1 Like

There is a tutorial to do tiles in g’mic, surely @grosgood ( or someone else) can do a version using photos/textures?

@Reptorian rectangle packing looks fun but it’s gonna be very hard to do while keeping order and not resizing, like you want…

Example 4:

foo :
  l[] { repeat 8 { 0 t. {`'HELOhelo'[$>]`},0,0,${"font SundayMilk,180"},1,${-RGB},255 } a z,0.5 round autocrop s z }
  1024,768,1,4 t. "Hello!",0.5~,0.5~,${"font SundayMilk,400"},1,255,128,0,255
  new_pack_sprites. [^-1],10,20,3,5 k.
  to_rgb.

4 Likes

Looks like a cool way to create patterned word clouds, David.
Below’s a Bing wordcloud image search what what I’m referring to. :slight_smile:

word cloud art - Search Images

@lylejk From the images that come up in your link, the idea for sprite packing to fill in certain spaces comes to mind; i.e. user would like to fill in each petal of a flower outline illustration with different sets of sprites. I am sure it is a doable filter. :wink:

Would be nice and cool way to create found object mosaics. I actually have searched and experimented with ways to create these for nearly 2 decades but I’m an end user and not a programmer. DAP (Dynamic Auto Painter) can come quite close but still just not there for what I believe JIM is. Even so, JIM requires masks and is not really color aware as I understand it. Another cool (but commercial) program is Pingotec (creates text artwork) but not sure the company that created this cool program still exists since I tried going to their website and it doesn’t come up. Oh well.

This one took a lot of time to render!

EDIT: Argh, I forgot to add “Pixls.us” in the possible strings. Will recompute that ASAP :slight_smile:
Here it is:

3 Likes

Now that’s a fantastic word cloud if I say so myself, David. :slight_smile:

You forgot G’mic !!

If you look at the picture from far enough away, you should be able to see it :wink:

Très drôle!! :upside_down_face:

@David_Tschumperle I like the first image more. I think that is because the brighter G’MIC text has more diagonal text. I wonder if it could be a control in the command or if it is too niche a feature.