RSS/Atom feed Twitter
Site is read-only, email is disabled

simple scripting question

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

simple scripting question Dan McMahill 06 Dec 04:35
  simple scripting question saulgoode@flashingtwelve.brickfilms.com 06 Dec 15:06
   simple scripting question Patrick Horgan 07 Dec 19:34
Dan McMahill
2009-12-06 04:35:43 UTC (about 15 years ago)

simple scripting question

Hello,

Has anyone written a script that would be a good starting point for the following task? I want to take an ascii file that has a bunch of names along with a number. Format is probably something like 1, name number 1
2, name number 2
1, name number 3
3, name number 4

then for each line in this file I want to start with a .xcf file which is selected by the first field (the 1-3) and then add the persons name as text on top of it. Then I want to write out the generated image and at the end up with a giant pdf file that I can send to the printer.

Basically I'm trying to make about 60 badges that will come in one of several styles and each will have someones name printed on it.

If anyone has something close they could share it would be much appreciated. Probably script-fu is my preference since I already speak scheme (but only a tiny bit of script-fu) but I could probably learn enough python to muddle through too.

Thanks -Dan

saulgoode@flashingtwelve.brickfilms.com
2009-12-06 15:06:43 UTC (about 15 years ago)

simple scripting question

I've had a go at this.

The files are all available in the following location: http://flashingtwelve.brickfilms.com/GIMP/Scripts/Badges/

There are two script files that need to be installed in your GIMP scripts folder. The main one is 'sg-create-badges.scm' which adds a "Create badges..." command under the File menu. The other script is 'sg-mosaicize.scm" which is required by the other to produce the final layout (it adds a "Mosaicize" command under the Filters->Map menu).

There are also an 'example.data' file and three sample badge style files: 'rainbow.xcf, 'seuss.xcf', and 'simple.xcf'. The topmost layer (typically transparent) of the style file's image is used to determine the location and size of the text of the person's name. The name text is centered within the bounds of this topmost layer (and then merged down to a single layer).

The format for the data file is quite simple and described in the comments of the 'sg-create-badges.scm' file. You should use fully qualified paths to the style files.

In the dialog for the script, you would select your data file, a font, the text color for the person's name, and a percent value for the font size (100% means use the largest font that will fit in the allotted area).

The result of the script is an image with a separate layer for each badge, as well as a background layer. The layout of these layers is a MxN grid. This layout is determined by the the Mosaicize script and chooses "M" and "N" such that the result is as close to square as possible (e.g., 11 badges would result in a 3x4 grid).

No file is written to disk.

Though not required, I would appreciate being notified if you improve the script (or even whether you find it useful).

Quoting Dan McMahill :

Hello,

Has anyone written a script that would be a good starting point for the following task? I want to take an ascii file that has a bunch of names along with a number. Format is probably something like 1, name number 1
2, name number 2
1, name number 3
3, name number 4

then for each line in this file I want to start with a .xcf file which is selected by the first field (the 1-3) and then add the persons name as text on top of it. Then I want to write out the generated image and at the end up with a giant pdf file that I can send to the printer.

Basically I'm trying to make about 60 badges that will come in one of several styles and each will have someones name printed on it.

If anyone has something close they could share it would be much appreciated. Probably script-fu is my preference since I already speak scheme (but only a tiny bit of script-fu) but I could probably learn enough python to muddle through too.

Thanks -Dan

Patrick Horgan
2009-12-07 19:34:52 UTC (about 15 years ago)

simple scripting question

saulgoode@flashingtwelve.brickfilms.com wrote:

I've had a go at this.

The files are all available in the following location: http://flashingtwelve.brickfilms.com/GIMP/Scripts/Badges/

I just want to comment that this is a great example of what makes the internet a cool place to play. He put a lot of work into this and is giving it to us for free. What a role model for the rest of us.

Patrick