Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Batch Numbering Images
#2
I found this, it's a command line/ .bat  for Microsoft's Windows > https://www.reddit.com/r/GIMP/comments/4...are_button

Code:
for /l %%x in (1, 1, 200) do (
  echo %%x
  magick convert ..\thumbnail.png -font "Segoe-UI-Black" -pointsize 203 -fill "#c97123" -annotate +900+613 "%%x" .\thumbnail%%x.png
)

This is using ImageMagick, go to read that post, the OP is explaining params & arguments

For a *nix system (Linux, mac) the command should look like

Code:
for i in {1..200}; do convert ./Desktop/test/image.png -font "Segoe-UI-Black" -pointsize 203 -fill "#c97123" -annotate +900+613 $i ./Desktop/test/result/image$i.png; done

1..200 => from number 1 to 200, increase decrease 200 as necessary (it's 199 images (200 minus 1) because you start at 1)
./Desktop/test/image.png = original image, thus I would write this way ./Desktop/test/$i.png (to process ALL png in that folder), located on your "Desktop", "test" folder (but all your image should follow a numbering name AKA 1.png, 2.png, 3.png...)
-font "Segoe-UI-Black" -pointsize 203 = -font "font-name" -size-of-the-font 203
-fill "color in hexa"
-annotate +900+613 = coordinate X,Y, in pixels of where to write?
$i - counting number to be written at those coordinates (if above are coordinates, which I think they are)
./Desktop/test/result/image$i.png = final image with numbering also in the name of the image (will be named "image1.png, image2.png, etc...), located on your "Desktop", "test" folder, "result" folder inside "test"

Note: the post is 8-yo, maybe the command did change a bit like the "convert"?, you could try, if it does not work I would wait for Rich2005 or Ofnuts, they will correct this code if something does not work (I use rarely imagemagick)



EDIT: OK I did tried on a folder the code below
First in the "test" folder, I batch renamed all my images in sequence number (it's needed because of the last code below), with:

Code:
ls -v | cat -n | while read n f; do mv -n "$f" "$n.jpg"; done

Then create the folder "result" in the "test" directory (if you did create it before the command above, the "result" folder was renamed to a "number.jpg", thus rename to "result")
Then did execute the code below, also ➤ I added a process number in terminal to not wait not knowing what's happening, now I can see what image it is processing  Big Grin

Code:
for i in {1..134};
do
  printf "Processing image No $i\r";
  convert ./Desktop/test/$i.jpg -font "Roboto" -pointsize 203 -fill "#c97123" -annotate +900+613 $i ./Desktop/test/result/image$i.jpg;
done

it worked like a charm, Rich2005 or Ofnuts certainly have a solution without the need of renaming the images like I did, though
Note for the return carriage AKA "\r", on macOS you might need to write "\r\c" instead ➤ printf "Processing image No $i\r\c"; (or/and for Microsoft "\r\n")
Patrice
Reply


Messages In This Thread
Batch Numbering Images - by gmpuser - 09-15-2024, 07:55 PM
RE: Batch Numbering Images - by PixLab - 09-16-2024, 01:48 AM
RE: Batch Numbering Images - by rich2005 - 09-16-2024, 10:07 AM
RE: Batch Numbering Images - by denzjos - 09-16-2024, 11:13 AM
RE: Batch Numbering Images - by gmpuser - 10-23-2024, 12:11 PM
RE: Batch Numbering Images - by PixLab - 09-16-2024, 01:18 PM
RE: Batch Numbering Images - by denzjos - 09-17-2024, 04:03 PM
RE: Batch Numbering Images - by gmpuser - 09-17-2024, 02:20 PM

Forum Jump: