Ask all general Gimp related questions here
Mon Feb 28, 2011 7:05 pm
The nasty things about patterns is that they aren't a "group".
So... I could
-provide a number of pattern picks and randomize those (which makes the dialog big)
-use SG's code to grab files from a directory and load them up as patterns and use them (slow)
-allow a text field where a number of pattern names could be specified to use (lots of possibility for error)
or... if the original issue is having pattern fills always line up, a simple solution might be to randomly offset (and scale?) each layer's fill using the active fill as a base. I'd have to play with this but there is some possibility there....
-Rob A>
Mon Feb 28, 2011 7:10 pm
RobA: Would we be able to determine those picks ourselves? You need me to send you some glass texture images?
Also, I liked the file-glob idea, I just couldn't get it to work, I'd be interested in seeing that code if you got it working.
I'm going to limit myself to easier tasks for script-fu until I get the hang of it.
Tue Mar 01, 2011 3:57 am
Well i am all for bigger dialogs, just add a minimize button please.
![laff out loud :lol](./images/smilies/lol.gif)
Provide a number of pattern picks - would be my choice.
![Smile :)](./images/smilies/icon_smile.gif)
Add a folder of patterns that come with the script so you can add what you want to it maybe?
Thanks Rob, i am looking forward to seeing the results.
Tue Mar 01, 2011 9:06 am
mahvin wrote:If you read my original post, my goal was to have my selections fill with random patterns, however, saulgoode mentioned something about pattern file usage being restricted to .pat files, but a lot of my glass patterns are .jpg and .png files. In my thinking process, I limited myself to "patterns" but then got to wondering why does it have to be patterns? Why couldn't it be "images" within a designated folder? I don't have the answer to this, I'm just asking. My idea with patterns was to make them all seamless and alter their sizes to suit the fill parameters, so larger patterns wouldn't overwhelm small selection areas.
I had misinterpreted your intentions and only addressed pattern files in a directory. You may have missed my post-posting edit
here (in red text) where I suggested a better approach would be to "
load the pattern file as an image, copy it to the clipboard, and fill using the clipboard as pattern". This approach should work equally well for other file formats (assuming they met tiling and sizing requirements).
Tue Mar 01, 2011 9:34 am
That's kind of what myself and PC mentioned earlier also, why not use any image?
Tue Mar 01, 2011 1:51 pm
Saulgoode: No. I read your comments. I just couldn't get the script to work. As for filling selections with clipboard content, what would be the point of a script if the process was manual? Or I am not understanding your comment.
I didn't see any script-fu for using clipboard content as fill.
Tue Mar 01, 2011 1:57 pm
mahvin wrote:Saulgoode: No. I read your comments. I just couldn't get the script to work. As for filling selections with clipboard content, what would be the point of a script if the process was manual? Or I am not understanding your comment.
I didn't see any script-fu for using clipboard content as fill.
You use a pattern fill and set the pattern context. This works even for foreign languages. Some others use "Clipboard" instead of "" but that only works in english:
- Code:
(gimp-context-set-pattern (list-ref (cadr (gimp-patterns-get-list "")) 0)) ; set patten to clipboard (first in list)
I'm 90% finished adding a "all images from a directory as random patterns". Just debugging...
-Rob A>
Tue Mar 01, 2011 2:27 pm
Ahhhh, this is good to know. I was looking in the PDB for "selections" not patterns.
Tue Mar 01, 2011 2:43 pm
OK - a couple of teasers:
![patternfill.jpg](./download/file.php?id=1508)
- patternfill.jpg (63.16 KiB) Viewed 2624 times
![patternfill2.jpg](./download/file.php?id=1507)
- patternfill2.jpg (62.5 KiB) Viewed 2624 times
And the code is attached since it is a big big to inline.
So this version looks for case insensitive jpeg, jpg, png, bmp and pat files. it creates a new invisible image, then loads all the files as layers and randomly sets the fill from those using the clipboard then destroys the temp image.
Two One thing
s:
1)
it destroys the clipboard contents2) the clipboard only supports 512x512 px patterns max.
-Rob A>
Tue Mar 01, 2011 2:54 pm
Thank you, RobA! I am extremely grateful!
You the man!
Getting this error:
Tue Mar 01, 2011 3:07 pm
Updated the version so clipboard gets replaced.
-Rob A>
Tue Mar 01, 2011 3:09 pm
COOL !!
Tue Mar 01, 2011 3:42 pm
I'm still getting the same error. Hmmm...
Tue Mar 01, 2011 4:23 pm
In investigating "modulo" I only see two instances of it in the palette option, and when I run the Palette option, it works fine, it's only when I use Patterns, it fails. I'm just blabbering because I am curious as to why modulo is having division by zero errors, when different options are used.
All the other multifill options work. I've even copied a pattern to the clipboard in advance, opened a pattern and copied, etc.
Another strange behavior is the SF-DIRNAME option on the multifill menu, each instance of opening it, it changes locations: (example being, each time I open the script for use, the location will be either - .gimp-2.6 or mahvin or patterns. It never remains consistently on one directory location, is this normal?
Tue Mar 01, 2011 4:44 pm
Another question: Since I am using this in Ubuntu, is there a slash direction issue with directories?
string-append has them as backslashes, but Linux uses a forward slash.
EDIT: It didn't make any difference, modulo division by zero error persists.
Tue Mar 01, 2011 6:10 pm
mahvin wrote:Another question: Since I am using this in Ubuntu, is there a slash direction issue with directories?
string-append has them as backslashes, but Linux uses a forward slash.
EDIT: It didn't make any difference, modulo division by zero error persists.
If you use slashes in Script-fu, the interpreter should perform any necessary conversions (though I am not certain of this since I don't typically use Windows). The best solution is to use the DIR-SEPARATOR constant.
In RobA's latest offering, try modifying all
"\\ strings to
DIR-SEPARATOR " strings (note that the quotation marks are included in the strings being specified). For example,
- Code:
(set! varFileList (append varFileList (cadr (file-glob (string-append inDir "\\*.[pP][nN][gG]") 1))))
becomes
- Code:
(set! varFileList (append varFileList (cadr (file-glob (string-append inDir DIR-SEPARATOR "*.[pP][nN][gG]") 1))))
Tue Mar 01, 2011 6:17 pm
YAY! That fixed it for Linux! Woohooo! Thank you, Saulgoode! And a big big thanks to RobA for getting it to this level.
I am super happy (and impressed!), I can now pre-plan my stained glass orientation for images by using pre-determined color palettes and glass texture alignment. I do this by making several image selection patterns, eliminating the larger selection outlines, and focusing each pattern on their own areas (sky, ground, people, objects), then recombine the patterns to make one whole pattern. This script gives me a lot of room to play with random and specified textures, and see the result before I cut one piece of glass.
Tue Mar 01, 2011 8:52 pm
I've updated the script with the suggested DIR-SEPARATOR.
Sorry for that, I had cut/pasted from an old script
![Frown :(](./images/smilies/icon_frown.gif)
(I need to go back and clean them all up me thinks....)
I also added a small change so a folder with no image files will just end up using whatever was in the clipboard rather than generating an error.
-Rob A>
Wed Mar 02, 2011 1:18 pm
NICE! Thanks Rob and Saul.
Sun Jun 26, 2011 3:17 pm
it looks pretty...I ended up using the patchwork script and playing with the size of the squares...didnt turn out exactly how I wanted but it was an ok result. But I can see where I could have improved and will remember some things if I try this again
Powered by phpBB © phpBB Group.
phpBB Mobile / SEO by Artodia.