I've had a go at this.

The files are all available in the following location:

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  

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 <d...@mcmahill.net>:

> 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
> _______________________________________________
> Gimp-user mailing list
> Gimp-user@lists.XCF.Berkeley.EDU
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Gimp-user mailing list

Reply via email to