It is currently 04 Mar 2021, 12:17

• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Match Squares Plug-in

Share your Python Fu Scripts/plug-ins for GIMP here
tim
GL Blogger

Match Squares Plug-in

Post#1 by tim » 22 Jan 2021, 12:43


This plug-in will allow you to run on an active layer and choose a (collage) paper layer in the same image.
It'll cut up your collage layer into squares and try to best match up to compose your active layer.
The difference here in this plug-in compared to other collage (experimental) plug-ins is that this plug-in will
only use each square once (instead of looking for best squares all the time it'll look for best square that is left unused), so that it'll use up entire collage paper layer (well, after initial cropping to fit image into nearest multiples of square dimension).
_________________________________________________
match_squares.py #
(4.78 KiB) Downloaded 19 times
match_squares.py #
version 2. Speedy version what would take 40hrs now takes 2hrs
(5.43 KiB) Downloaded 18 times
Menu Location: Python-Fu/AA Match Squares...
Instructions:
  1. Have your desired source picture and collage paper picture opened as layers on the same image.
  2. Click and select the source layer (layer to try to compose).
  3. Run plug-in, select the collage paper layer as paper/collage layer, select dimension of square/tile and OK to run.
  4. Now go to bed, once of twice. Plug-in will show progress bar eventhough it takes a really long time.
  5. Plug-in will alter your image (such as possible cropping down to nearest multiples of dimension and add a new result/working layer).
_________________________________________________

Testing phase:
Shown below are active layer (on left), (collage) paper layer (middle), and work done so far on work-layer (right).
Match-squares.jpg
Match-squares.jpg # (47.09 KiB) Viewed 1080 times (Thumbnail | Recognize)
After about 6hrs (from 10:30pm to 4:30am) it has done about 35 squares out of 600 squares/tiles.

This seems like it's only a little over 5% done. But it has done about 11% of the searching/checking steps.
Because it's faster or has less squares to check as it approaches the end: Like for the 1st square it has to check all 600 squares to determine which is best one, but for the last square it'll just use the last square because that's the only square left.

Hopefully this will result in something interesting otherwise it's a complete waste of time.
guitarist-compare.jpg
Generated with version 2 fast version
guitarist-compare.jpg # (68.9 KiB) Viewed 1022 times (Thumbnail | Recognize)
aka Tin

         

tim
GL Blogger

Post#2 by tim » 22 Jan 2021, 17:09


For those who'd like to venture into the unknown, you can try plug-in before I finish testing (since my testing will a long time).
I have tested on smaller number of tiles and the code runs fine. The unknown is how interesting the end result will look.
aka Tin

         

Krikor
Forum Member

Post#3 by Krikor » 22 Jan 2021, 21:06


I didn't quite understand what to expect from this plugin, but out of curiosity, I already put it to run :-)

Now it's to see how long it takes to finish editing and what it produces.

BTW Tim, I suppose your new plug-in will possibly have the initials AAA-PluginName in its name. ;)
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston

Krikor
Forum Member

Post#4 by Krikor » 22 Jan 2021, 21:11


Oh ... that was quick, it ended while I typed the previous comment.
I used a small image for testing purposes only. I hope the time is fast also with larger images.
Attachments
foirapido.jpg
Krikor - Match Square plug-in test01
foirapido.jpg # (42.81 KiB) Viewed 1048 times (Thumbnail | Recognize)
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston

Krikor
Forum Member

Post#5 by Krikor » 22 Jan 2021, 21:31


Tim,

I didn't understand the need for two images for this plugin to run. It seems that he cuts and shuffles pieces of one of the images, without any interaction with the other image.

I thought it was going to get a mix between the images involved (as in the image below where I manually produced the blend between the two images) and that therefore the need for two images.
foirapido02.jpg
Krikor - anothter try
foirapido02.jpg # (43.89 KiB) Viewed 1043 times (Thumbnail | Recognize)
I am now running the plug-in with the same images in larger and different sizes. This time one of the selected images is smaller than the other. I want to see what will result and the time it will take.
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston

tim
GL Blogger

Post#6 by tim » 22 Jan 2021, 23:17


Just uploaded Fast version (2). What would take 40+hrs now should take about 2hrs.
I am running both versions concurrently right now. I guess I still have to verify that it's doing what it was intended.
But version 2 is there for those who'd like to try.
aka Tin

         

tim
GL Blogger

Post#7 by tim » 22 Jan 2021, 23:27


Krikor wrote:
22 Jan 2021, 21:31
Tim,

I didn't understand the need for two images for this plugin to run. It seems that he cuts and shuffles pieces of one of the images, without any interaction with the other image.

I thought it was going to get a mix between the images involved (as in the image below where I manually produced the blend between the two images) and that therefore the need for two images.
foirapido02.jpg
I am now running the plug-in with the same images in larger and different sizes. This time one of the selected images is smaller than the other. I want to see what will result and the time it will take.
You need two layers because the layer you run on is what it uses to compare and try to compose best it can with the collage layer.
I guess it would be more obvious if the image had more tiles (of smaller dimensions) then the image it's trying to compose will reveal itself through the use of collage paper layer.
aka Tin

         

Krikor
Forum Member

Post#8 by Krikor » 22 Jan 2021, 23:34


tim wrote:
22 Jan 2021, 23:17
Just uploaded Fast version (2). What would take 40+hrs now should take about 2hrs.
I am running both versions concurrently right now. I guess I still have to verify that it's doing what it was intended.
But version 2 is there for those who'd like to try.
I will cancel the plug-in progress. 40 hours is a long time. It's been about two hours and only part of the image has been covered.
after2hours.jpg
Krikor - anoter test03
after2hours.jpg # (17.89 KiB) Viewed 1027 times (Thumbnail | Recognize)
I will test version 2, but this time I will choose areas larger than 50x50, maybe it will run faster as they will be less square to be filled in
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston

tim
GL Blogger

Post#9 by tim » 22 Jan 2021, 23:44


Krikor wrote:
22 Jan 2021, 23:34
tim wrote:
22 Jan 2021, 23:17
Just uploaded Fast version (2). What would take 40+hrs now should take about 2hrs.
I am running both versions concurrently right now. I guess I still have to verify that it's doing what it was intended.
But version 2 is there for those who'd like to try.
I will cancel the plug-in progress. 40 hours is a long time. It's been about two hours and only part of the image has been covered.
after2hours.jpg
I will test version 2, but this time I will choose areas larger than 50x50, maybe it will run faster as they will be less square to be filled in
Yeah cancel progress never worked for me with any plug-in.
If I want to see result while it's running I duplicate the image and then play the the duplicated while plug-in runs on the original.
If I want to stop the plug-in I just delete original image and then errors and thrown and it quits.
Yeah definitely try version 2 it's much faster and I think your machine is faster than mine too.
aka Tin

         

Krikor
Forum Member

Post#10 by Krikor » 23 Jan 2021, 00:07


Tim,

As I used 32 squares in the previous (reduced) image, I calculated the area of the squares to also give approximately 32 squares for the larger images, which gave ...

I was typing this text when I went to check the value used ... the plugin had already finished running!
Attachments
rapidodemais.jpg
Krikor - Another test04
rapidodemais.jpg # (132.06 KiB) Viewed 1023 times (Thumbnail | Recognize)
"I feel that in both art and music, it's not the success that matters but the pleasure it gives you. Focus on the pleasure and the learning will come naturally." - Brian Weston


GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply New Topic
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 12 guests