It is currently 22 May 2022, 00:26

• Featuring Members' Images •
Could be related to 'Gray Pattern Script for GIMP'
tim
Pat625
tim
Pat625
Ella

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

Gray Pattern Script for GIMP

Share your Python Fu Scripts/plug-ins for GIMP here
Pat625
Tutorial Creator
2nd Place
4522 Post(s)

Re: Gray Pattern Script for GIMP

Post#31 by Pat625 » 30 Jul 2017, 23:56


TinTran.GrayPattern6.Standard.jpg
TinTran.GrayPattern6.Standard.jpg # (340.27 KiB) Viewed 2261 times Thumbnail
TinTran.GrayPattern6.Standard.flowers.light effect.jpg
TinTran.GrayPattern6.Standard.flowers.light effect.jpg # (155.72 KiB) Viewed 2261 times Thumbnail
TinTran.GrayPattern6.Standard Gray.StackedRocks.jpg
TinTran.GrayPattern6.Standard Gray.StackedRocks.jpg # (290.11 KiB) Viewed 2261 times Thumbnail
TinTran.GrayPattern6.MultiCircles.Dandelion.jpg
TinTran.GrayPattern6.MultiCircles.Dandelion.jpg # (328.21 KiB) Viewed 2261 times Thumbnail
TinTran.GrayPattern6.Circles.Woman.Rocks.jpg
TinTran.GrayPattern6.Circles.Woman.Rocks.jpg # (246.19 KiB) Viewed 2261 times Thumbnail
TinTran.GrayPattern6.circles.Horses.jpg
TinTran.GrayPattern6.circles.Horses.jpg # (294.55 KiB) Viewed 2261 times Thumbnail

Pat625
Tutorial Creator
2nd Place
4522 Post(s)

Post#32 by Pat625 » 04 Aug 2017, 20:26


TinTran.Gray.Standard.jpg
TinTran.Gray.Standard.jpg # (227.07 KiB) Viewed 2241 times Thumbnail

oldmangrumpy
Tutorial Creator
10th Place
1438 Post(s)

Post#33 by oldmangrumpy » 04 Aug 2017, 21:04


How did I miss this thread - Issabella, Pat and Gnerd, some very evocative imagery.

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

Pat625
Tutorial Creator
2nd Place
4522 Post(s)

Post#34 by Pat625 » 15 Aug 2017, 01:39


TinTran.GrayPatternStandard.Dolphin.jpg
TinTran.GrayPatternStandard.Dolphin.jpg # (167.31 KiB) Viewed 2214 times Thumbnail

Krikor
Forum Member
14th Place
1015 Post(s)

Post#35 by Krikor » 14 Apr 2022, 17:50


tim wrote:
24 Jul 2017, 18:14
This 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
Hi Tim,

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
GL Blogger
1st Place
5822 Post(s)

Post#36 by tim » 29 Apr 2022, 11:15


If you choose circles only then you can just download version 6 and the Multi-circles patterns.
aka Tin
World Food Program | Good Deeds Forum

         

Krikor
Forum Member
14th Place
1015 Post(s)

Post#37 by Krikor » 01 May 2022, 04:18


tim wrote:
29 Apr 2022, 11:15
If you choose circles only then you can just download version 6 and the Multi-circles patterns.
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
GL Blogger
1st Place
5822 Post(s)

Post#38 by tim » 01 May 2022, 04:43


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.
aka Tin
World Food Program | Good Deeds Forum

         

Krikor
Forum Member
14th Place
1015 Post(s)

Post#39 by Krikor » 01 May 2022, 06:04


tim wrote:
01 May 2022, 04:43
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.
Okay, I'll try.
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
Forum Member
14th Place
1015 Post(s)

Post#40 by Krikor » 01 May 2022, 11:45


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!
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


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 28 guests