It is currently 21 May 2022, 06:48
| ||||
| ||||
|
|

Gray Pattern Script for GIMP

- Pat625
-
2nd Place
- 4522 Post(s)
- Pat625
-
2nd Place
- 4522 Post(s)
- oldmangrumpy
-
10th Place
- 1438 Post(s)
How did I miss this thread - Issabella, Pat and Gnerd, some very evocative imagery.
Done the downloads now to try out the filter!
Done the downloads now to try out the filter!
Senior's moments are just part of a lifelong learning experience - never stop learning
OMG's: Downunder Art Thread | Gold Ring Addiction
OMG's: Downunder Art Thread | Gold Ring Addiction
- Pat625
-
2nd Place
- 4522 Post(s)
-
Krikor
-
14th Place
- 1015 Post(s)
Hi Tim,tim wrote: ↑24 Jul 2017, 18:14This is a simple script that turns an image into a black and white image and fills it with predefined pattern.
[...]
Script Menu Location: Python-Fu/Gray Pattern...
Instructions:
1. Have an image opened with your active layer (image that you want to convert to Gray Pattern).
2. Run script (Python-Fu/Gray Pattern). Choose number of patterns (1-19). Then OK to run script.
3. Let the Magic happen and you'll get a retro black and white image of the image you want to convert.
Sample result (width 1200 seem to work best i think).
gray_pattern.png
I would like to test this script, but I have some doubts.
Does each version produce its own result?
I see that Version 2 allows Ipattern (diagonal) and Version 6 allows Circles.
Or would version 6 be an upgrade with all options from previous versions allowed?
As for the Patterns, would it be enough to install the Circle_Multi_patterns(m) only, or would it be necessary to download the other 3 available pattern options?
Thanks for any clarification!
"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
-
1st Place
- 5822 Post(s)
- View:
|Posts
- Topic Posts: 0/46 | Posts: 5822
- Joined: 26 Sep 2016, 00:16
- Cash on hand: 86,484.96 GLP
- Bank: 6,254,306,164.00 GLP
- Gender: Guy
- Location: Canada
- GIMP Version: 2.10.X
- Paint Blotches blog
- Play them songs blog
- Personal Blog
- x 3357
- x 1369
- Contact:
If you choose circles only then you can just download version 6 and the Multi-circles patterns.
-
Krikor
-
14th Place
- 1015 Post(s)
Tim,
I tried to understand how the plugin uses the patterns to produce the final effect.
I noticed that in line 37 of the code are the threshold values associated with each pattern.
In line 90 of the code the initials of the patterns are associated with the thresholds ("1" ("i" ?), "o", "m").
My assumption is that if I replace the original patterns with other patterns (but keeping the same name as the original pattern) I could customize the plugin.
For example, I would remove the I0, I25, ..., I229, I255.pat patterns. I would put other patterns but keep the same name.
But that wouldn't be a correct way since the .pat names are determined by their thresholds.
So I should find the correct threshold values for my patterns and then make the appropriate change in the code (lines 37 to 40).
The whole point is that I don't know how the threshold values were obtained for the .pat of the 4 types of patterns that the plugin uses.
That is, let's say I have a pre-defined pattern formed by 6 .pat, how do I get to the threshold values of these specific .pat?
Thx Tim!
"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
-
1st Place
- 5822 Post(s)
- View:
|Posts
- Topic Posts: 0/46 | Posts: 5822
- Joined: 26 Sep 2016, 00:16
- Cash on hand: 86,484.96 GLP
- Bank: 6,254,306,164.00 GLP
- Gender: Guy
- Location: Canada
- GIMP Version: 2.10.X
- Paint Blotches blog
- Play them songs blog
- Personal Blog
- x 3357
- x 1369
- Contact:
you can add a custom pattern type to the end
like for example line 118
(PF_OPTION,"type", "Gray Pattern Type:", 0, ["Standard Gray Pattern","Diagonals","Circles","Circles Multi","Krikor"]),
then add below line 97
elif type == 4: #prepend the "k" in front of pattern.
pdb.gimp_context_set_pattern("k" + str(patterns[type][closest]))
then for line 37 - 40
you can add a 5 array like this to
patterns = [[0,10,20,35,45,56,71,81,91,99,107,117,132,147,165,183,206,229,255],
[0,25,51,76,102,127,153,178,204,229,255],
[0,54,94,126,156,183,205,223,236,247,252,255],
[0,54,64,78,94,117,135,143,158,174,182,198,215,230,244,255],
[0,10,20,30,40,50]
]
where the [0,10,20,30,40,50] can be any number in sequence representing your gray values (0-255) of filenames prepended with 'k'
there's a function named 'closest_index' in the code that will find the correct file names depending on gray values of the image.
like for example line 118
(PF_OPTION,"type", "Gray Pattern Type:", 0, ["Standard Gray Pattern","Diagonals","Circles","Circles Multi","Krikor"]),
then add below line 97
elif type == 4: #prepend the "k" in front of pattern.
pdb.gimp_context_set_pattern("k" + str(patterns[type][closest]))
then for line 37 - 40
you can add a 5 array like this to
patterns = [[0,10,20,35,45,56,71,81,91,99,107,117,132,147,165,183,206,229,255],
[0,25,51,76,102,127,153,178,204,229,255],
[0,54,94,126,156,183,205,223,236,247,252,255],
[0,54,64,78,94,117,135,143,158,174,182,198,215,230,244,255],
[0,10,20,30,40,50]
]
where the [0,10,20,30,40,50] can be any number in sequence representing your gray values (0-255) of filenames prepended with 'k'
there's a function named 'closest_index' in the code that will find the correct file names depending on gray values of the image.
-
Krikor
-
14th Place
- 1015 Post(s)
Okay, I'll try.tim wrote: ↑01 May 2022, 04:43you can add a custom pattern type to the end
like for example line 118
(PF_OPTION,"type", "Gray Pattern Type:", 0, ["Standard Gray Pattern","Diagonals","Circles","Circles Multi","Krikor"]),
then add below line 97
elif type == 4: #prepend the "k" in front of pattern.
pdb.gimp_context_set_pattern("k" + str(patterns[type][closest]))
then for line 37 - 40
you can add a 5 array like this to
patterns = [[0,10,20,35,45,56,71,81,91,99,107,117,132,147,165,183,206,229,255],
[0,25,51,76,102,127,153,178,204,229,255],
[0,54,94,126,156,183,205,223,236,247,252,255],
[0,54,64,78,94,117,135,143,158,174,182,198,215,230,244,255],
[0,10,20,30,40,50]
]
where the [0,10,20,30,40,50] can be any number in sequence representing your gray values (0-255) of filenames prepended with 'k'
there's a function named 'closest_index' in the code that will find the correct file names depending on gray values of the image.
Thank you very much Tim!
"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
-
14th Place
- 1015 Post(s)
Tim, after making the recommended changes the plugin no longer appears in the menu.
At first I thought it could have been because I didn't use the value 0 (zero) for the lowest threshold of the patterns. In fact I tried to avoid it.
But even after adjusting the lowest initial value to 0 (zero) the plugin is still not displayed in the menu.
When Gimp is restarted the plugin loading is displayed, but it is not in the "Python-Fu" menu.
For information, I didn't use .pat for the patterns, I created them in .png. And the name of the files I didn't use the .pat prefix, I just used the letter k followed by the threshold value.
But I think that if that was the reason for the problem, the plugin would appear in the menu but accuse some kind of error, which is not the case.
Attached is the plugin with the changes you suggested. Maybe you could find what is causing this problem.
Thank you for your help!
At first I thought it could have been because I didn't use the value 0 (zero) for the lowest threshold of the patterns. In fact I tried to avoid it.
But even after adjusting the lowest initial value to 0 (zero) the plugin is still not displayed in the menu.
When Gimp is restarted the plugin loading is displayed, but it is not in the "Python-Fu" menu.
For information, I didn't use .pat for the patterns, I created them in .png. And the name of the files I didn't use the .pat prefix, I just used the letter k followed by the threshold value.
But I think that if that was the reason for the problem, the plugin would appear in the menu but accuse some kind of error, which is not the case.
Attached is the plugin with the changes you suggested. Maybe you could find what is causing this problem.
Thank you for your help!
- Attachments
-
-
gray_pattern.py #
- gray_pattern edited - Test Mode
- (5.54 KiB) Downloaded 7 times
-
"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
| ||||
| ||||
|
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Independent from GIMP - Picture to Cross-Stitch Pattern Tool
by tim » 24 Sep 2021, 12:50 » in Anything Goes - 1 Replies
- 680 Views
-
Last post by tim
24 Sep 2021, 15:05
-
-
- 2 Replies
- 486 Views
-
Last post by tim
26 Nov 2021, 23:47
-
- 2 Replies
- 2559 Views
-
Last post by Krikor
30 Jun 2021, 19:38
-
-
Who knows the name of this script? /Solved
by Jappaloe63 » 25 Oct 2021, 11:33 » in GIMP Script Requests - 2 Replies
- 928 Views
-
Last post by Jappaloe63
25 Oct 2021, 17:30
-
-
-
Custom Font Edger for Gimp 2.10 Release 0.1
by skinnyhouse » 30 May 2021, 14:14 » in GIMP Python Fu Scripts/Plug-ins - 1 Replies
- 2903 Views
-
Last post by skinnyhouse
31 May 2021, 07:38
-
-
-
Custom Font Paths to Layers for Gimp 2.10: Release 0.04
by skinnyhouse » 11 Jun 2021, 11:47 » in GIMP Python Fu Scripts/Plug-ins - 16 Replies
- 8613 Views
-
Last post by Pat625
23 Jun 2021, 05:25
-
-
-
Custom Font Paths to Layers for Gimp 2.10: Release 0.05
by skinnyhouse » 25 Jun 2021, 15:38 » in GIMP Python Fu Scripts/Plug-ins - 6 Replies
- 4175 Views
-
Last post by skinnyhouse
09 Jul 2021, 11:46
-
Who is online
Users browsing this forum: No registered users and 21 guests