Gimp-Forum.net
Automatic text fill - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Automatic text fill (/Thread-Automatic-text-fill)



Automatic text fill - taholmes160 - 01-08-2023

HI folks:

I am building some game assets for a railroading game, and each one has a unique number on it in 2 different locations.  the number itself is random, is there a way to automate the process some how?

It takes about 30 seconds or so to create a livery (Its a bit tedious) and by the time this is done, I will have several hundred of them

Any suggestions?

TIM


RE: Automatic text fill - rich2005 - 01-09-2023

Bumping this up in case anyone has a good idea for Gimp.

I think you might be better off using command line ImageMagick (IM). http://www.imagemagick.org and a good forum https://github.com/ImageMagick/ImageMagick/discussions

I can get a result (of sorts) with a list of numbers, random or otherwise in a text file, and a set of numbered images.
Planting the number in two places on an image.

...but I use linux and not too sure about the equivalent Windows batch commands.

The linux file looks like this, for simplicity takes a png as input and outputs a jpeg.

Code:
#!/bin/bash

file=$(cat list.txt)
img=1
for line in $file
do
  echo "$line"
    magick $img.png \
    -gravity South -font Arial -pointsize 32 -fill white -annotate +0+5 $line \
    -gravity North -font Arial -pointsize 32 -fill white -annotate +0+5 $line \
    $img.jpg
  img=$((img+1))
done

..no use for Windows, just as an example, although the magic command will work


RE: Automatic text fill - taholmes160 - 01-09-2023

(01-09-2023, 11:06 AM)rich2005 Wrote: Bumping this up in case anyone has a good idea for Gimp.

I think you might be better off using command line ImageMagick (IM).   http://www.imagemagick.org and a good forum https://github.com/ImageMagick/ImageMagick/discussions

I can get a result (of sorts) with a list of numbers, random or otherwise in a text file, and a set of numbered images.
Planting the number in two places on an image.

...but I use linux and not too sure about the equivalent Windows batch commands.

The linux file looks like this, for simplicity takes a png as input and outputs a jpeg.

Code:
#!/bin/bash

file=$(cat list.txt)
img=1
for line in $file
do
 echo "$line"
   magick $img.png \
   -gravity South -font Arial -pointsize 32 -fill white -annotate +0+5 $line \
   -gravity North -font Arial -pointsize 32 -fill white -annotate +0+5 $line \
   $img.jpg
 img=$((img+1))
done

..no use for Windows, just as an example, although the magic command will work

I have a linux computer, so thats no issues -- i'll have to look into this a bit more -- can it be modified to output as a png as well?

TIM


RE: Automatic text fill - rich2005 - 01-09-2023

Quote:....snip...can it be modified to output as a png as well?

It can, If you have IM from a linux repo then the command magick probably = convert. I use the linux magick appimage from their site.

Many formats supported typically

magick infile.ext outfile.ext

...although if you want infile.png > (modified) infile.png write the new file to a new folder and apply a path in the commandline.

edit: just a reminder the images are sequentially numbered 1.png 2.png....n.png the list.txt file contains the random numbers, one per line. Lookup the linux shuf command.