GIMP Chat
http://gimpchat.com/

Multi-Fill Script Help
http://gimpchat.com/viewtopic.php?f=8&t=1221
Page 3 of 16

Author:  RobA [ Mon Feb 28, 2011 7:05 pm ]
Post subject:  Re: Multi-Fill Script Help

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>

Author:  mahvin [ Mon Feb 28, 2011 7:10 pm ]
Post subject:  Re: Multi-Fill Script Help

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.

Author:  Rod [ Tue Mar 01, 2011 3:57 am ]
Post subject:  Re: Multi-Fill Script Help

Well i am all for bigger dialogs, just add a minimize button please. :lol
Provide a number of pattern picks - would be my choice. :)
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.

Author:  saulgoode [ Tue Mar 01, 2011 9:06 am ]
Post subject:  Re: Multi-Fill Script Help

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).

Author:  Rod [ Tue Mar 01, 2011 9:34 am ]
Post subject:  Re: Multi-Fill Script Help

That's kind of what myself and PC mentioned earlier also, why not use any image?

Author:  mahvin [ Tue Mar 01, 2011 1:51 pm ]
Post subject:  Re: Multi-Fill Script Help

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.

Author:  RobA [ Tue Mar 01, 2011 1:57 pm ]
Post subject:  Re: Multi-Fill Script Help

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:

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

Author:  mahvin [ Tue Mar 01, 2011 2:27 pm ]
Post subject:  Re: Multi-Fill Script Help

Ahhhh, this is good to know. I was looking in the PDB for "selections" not patterns.

Author:  RobA [ Tue Mar 01, 2011 2:43 pm ]
Post subject:  Re: Multi-Fill Script Help

OK - a couple of teasers:
Attachment:
patternfill.jpg
patternfill.jpg [ 63.16 KiB | Viewed 2608 times ]

Attachment:
patternfill2.jpg
patternfill2.jpg [ 62.5 KiB | Viewed 2608 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 things:

1)it destroys the clipboard contents
2) the clipboard only supports 512x512 px patterns max.

-Rob A>

Attachments:
FlattingTools.scm [15.24 KiB]
Downloaded 175 times

Author:  mahvin [ Tue Mar 01, 2011 2:54 pm ]
Post subject:  Re: Multi-Fill Script Help

Thank you, RobA! I am extremely grateful!

You the man!

Getting this error:
Image

Author:  RobA [ Tue Mar 01, 2011 3:07 pm ]
Post subject:  Re: Multi-Fill Script Help

Updated the version so clipboard gets replaced.

-Rob A>

Author:  PhotoComix [ Tue Mar 01, 2011 3:09 pm ]
Post subject:  Re: Multi-Fill Script Help

COOL !!

Author:  mahvin [ Tue Mar 01, 2011 3:42 pm ]
Post subject:  Re: Multi-Fill Script Help

I'm still getting the same error. Hmmm...

Author:  mahvin [ Tue Mar 01, 2011 4:23 pm ]
Post subject:  Re: Multi-Fill Script Help

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?

Author:  mahvin [ Tue Mar 01, 2011 4:44 pm ]
Post subject:  Re: Multi-Fill Script Help

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.

Author:  saulgoode [ Tue Mar 01, 2011 6:10 pm ]
Post subject:  Re: Multi-Fill Script Help

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,
        (set! varFileList (append varFileList (cadr (file-glob (string-append inDir "\\*.[pP][nN][gG]") 1))))

becomes

        (set! varFileList (append varFileList (cadr (file-glob (string-append inDir DIR-SEPARATOR "*.[pP][nN][gG]") 1))))

Author:  mahvin [ Tue Mar 01, 2011 6:17 pm ]
Post subject:  Re: Multi-Fill Script Help

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.

Image

Author:  RobA [ Tue Mar 01, 2011 8:52 pm ]
Post subject:  Re: Multi-Fill Script Help

I've updated the script with the suggested DIR-SEPARATOR.

Sorry for that, I had cut/pasted from an old script :( (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>

Author:  Rod [ Wed Mar 02, 2011 1:18 pm ]
Post subject:  Re: Multi-Fill Script Help

NICE! Thanks Rob and Saul.

Author:  akky [ Sun Jun 26, 2011 3:17 pm ]
Post subject:  Re: Multi-Fill Script Help

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

Attachments:
Le_Paradise_Patou_tutorial.jpg
Le_Paradise_Patou_tutorial.jpg [ 62.94 KiB | Viewed 2051 times ]

Page 3 of 16 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/