Gimp-Forum.net
ofn-random-pattern - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+--- Thread: ofn-random-pattern (/Thread-ofn-random-pattern)

Pages: 1 2


ofn-random-pattern - Ofnuts - 12-22-2023

This plugin is an equivalent of bucket-fill with patterns, except that it uses several patterns at random. In other words, provided with an image like this:

[attachment=10922]

It creates this:

[attachment=10923]
Available at the usual place.

Enjoy.


RE: ofn-random-pattern - Tas_mania - 12-22-2023

Very cool Mr ofnuts.
The beauty of 'random' is you get a different result every time Big Grin Big Grin


RE: ofn-random-pattern - Ofnuts - 12-22-2023

(12-22-2023, 10:32 PM)Tas_mania Wrote: Very cool Mr ofnuts.
The beauty of 'random' is you get a different result every time Big Grin Big Grin

I wish it were true... The plugin uses HSV noise but there is no access to the random seed in the API so you technically get the same pattern of pixels every time. I sort of hide this by randomly offsetting the layer (so the pattern is shifted) and shuffling the pattern layers. But I'm still trying to find a better solution.

Hmmm. But as I speak I have a solution, the pattern I need is very small (a pixel for each "tile") so instead of generating a tiny layer, I can generate a large layer of random pixels (always the same since I can't control Gimp seed) that I cut at random coordinates, this randomness coming from the Python side, where I can control the seed. Stay tuned Smile

Otherwise, no difficulties to report?


RE: ofn-random-pattern - Tas_mania - 12-23-2023

I recently used a 'randomizer' to generate fractals. It randomizes up to 4 parameters of a fractal. The results are often not good to use but are always different.

I guess you have to work with the API rather than applying values to it. All I can add is the unix rand app is only about 30kb but python must also have a random number generator. Good luck with what you are doing.


RE: ofn-random-pattern - PixLab - 12-23-2023

Nice!


RE: ofn-random-pattern - Blighty - 12-23-2023

Tim made a similar one that was posted on the old Gimp Learn.

It was designed to make Truchet patterns.


RE: ofn-random-pattern - Ofnuts - 12-23-2023

(12-23-2023, 06:04 AM)Blighty Wrote: Tim made a similar one that was posted on the old Gimp Learn.

It was designed to make Truchet patterns.

I claim much better performance. On a 45x20 pattern (the balls) laid out in a 20x20 grid: Tin's script takes 28 seconds, while mine takes less than two. The way it is written Tin's script loops on each item of the final image, so its execution time is proportional to the total number of copied tiles. By contrast my script uses a bucket-fill, so its run time is mostly proportional to the number of source tiles.

Also, abides to selection, and works on current layer & image. Choose wisely Big Grin

PS: Just uploaded a new versions that fixes the randomness problem.


RE: ofn-random-pattern - Ofnuts - 12-23-2023

Another upload to fix a problem with transparent patterns Rolleyes


RE: ofn-random-pattern - PixLab - 12-23-2023

Just discovering the Tin's plugin (thanks to Blighty), thus I did few tests  Big Grin
Tests made with the Ofnuts' latest transparency fix as well.

The final size of the file/resources difference is quite big (below on an image of 6025x6675 px 36 tiles)

Truchet result : 2.5 GB (with random flip activated)
[attachment=10929]

Random pattern from tiles result : 39.5 GB
[attachment=10928]

my computer started to reach its limit as I had time to see clearly what was going on, on the mask while the random pattern from tiles' script was running
Ofnuts, is there a way you can lower that end result size?

The random flip of the truchet is nice, it makes randomness looks more random or it looks like we have more patterns as the same pattern once flipped can look like another pattern
Just a suggestion to Ofnuts to add a random flip horizontal and flip vertical as separate options Big Grin
[attachment=10930]


RE: ofn-random-pattern - Ofnuts - 12-23-2023

(12-23-2023, 04:06 PM)PixLab Wrote: Just discovering the Tin's plugin (thanks to Blighty), thus I did few tests  Big Grin
Tests made with the Ofnuts' latest transparency fix as well.

The final size of the file/resources difference is quite big (below on an image of 6025x6675 px 36 tiles)

Truchet result : 2.5 GB (with random flip activated)


Random pattern from tiles result : 39.5 GB


my computer started to reach its limit as I had time to see clearly what was going on, on the mask while the random pattern from tiles' script was running
Ofnuts, is there a way you can lower that end result size?

The random flip of the truchet is nice, it makes randomness looks more random or it looks like we have more patterns as the same pattern once flipped can look like another pattern
Just a suggestion to Ofnuts to add flip horizontal and flip vertical as separate options  Big Grin

If you want Flip/Rotate you can duplicate and flip/rotate the layers in the patterns image. You can even make 45° rotations if you want. Dealing with each tile individually is what kills the performance of Tin's script.

This said, starting from scratch, I get this:

[attachment=10931]

So, nowhere near what you get, and if the image is around 10G, the dash board only reports half of that... So the figures you show may have something to do with previous history of the image and with its unmentioned precision.