Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Batch Numbering Images
#1
Is there a way to add text/watermark to a batch of images? I want to use a kind of counter tool to add text starting from 1 and counting upwards:

1
2
3
...
10
11
...
99
100
101

I would also need to adjust the font including size and style.

Thank you for any help that can be provided.
Reply
#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
#3
Much hunting through my archives but not able to find any easy GUI way using Gimp (or BIMP for batch operation)

...then it all depends on the source images. 

If it just a background then there is a plugin to create "number" layers and add the background image - say for making raffle tickets.

If the images are different but the same size then adding them as layers and interleaving number layers is a possibility.

Otherwise Imagemagick as Pixlab indicates. This is my script for linux. Uses the magick appimage. Sorry not much use at Windows batch files these days

Code:
#!/bin/bash

# run as an executable in the image folder otherwise it does not increment
# change image format to suit.

N=1
for f in *.png; do

# Generate the annotation text in whatever format is desired
   annotation=$(printf "Image: %03d" $N)

#set the font / size /position - put the ttf in same directory as images

   magick "$f" -fill white -undercolor '#00000080' -gravity South -font albrertusbold.ttf -pointsize 24 -annotate +0+5 "$annotation" -set filename:orig %t %[filename:orig].jpg

   ((N=N+1))
done
Reply
#4
Just found this (payed):
https://www.uconomix.com/Products/uMark/...-watermark

You can use Irfanview after batch renaming your files with some of those :
Batch rename : https://marketdive.net/en/file-bulk-rename-tools-en/
Watermark : https://info.bannerengineering.com/cs/id...&dID=60006

Maybe you can find something here :  
https://alternativeto.net/software/umark/
https://slashdot.org/software/p/uMark/alternatives
https://watermark-image.en.softonic.com/...tives/free
Reply
#5
Ah.. Graphical  Big Grin

XnConvert and/or XnView MP will do it easy peasy

In XnConvert, Add an Action > Image > Text, Settings for text appear, in the field just input # this will start from 0 up to the end of all images (in my case 133), worked like a charm
Ref: https://newsgroup.xnview.com/viewtopic.php?t=37314

   
Patrice
Reply
#6
Great, thank you for the replies. I have been renaming the filenames to number but I had a couple of situations where I needed two sets of numbers on each image. I have downloaded and used XnConvert. I am familiar with XnView for batch processing but not heard of this before. This has solved the issue for me. Thanks for the help
Reply
#7
(09-16-2024, 01:18 PM)PixLab Wrote: Ah.. Graphical  Big Grin

XnConvert and/or XnView MP will do it easy peasy

In XnConvert, Add an Action > Image > Text, Settings for text appear, in the field just input # this will start from 0 up to the end of all images (in my case 133), worked like a charm
Ref: https://newsgroup.xnview.com/viewtopic.php?t=37314
PixLab, thanks for the tip Idea
Reply
#8
(09-16-2024, 11:13 AM)denzjos Wrote: Just found this (payed):
https://www.uconomix.com/Products/uMark/...-watermark

You can use Irfanview after batch renaming your files with some of those :
Batch rename : https://marketdive.net/en/file-bulk-rename-tools-en/
Watermark : https://info.bannerengineering.com/cs/id...&dID=60006

Maybe you can find something here :  
https://alternativeto.net/software/umark/
https://slashdot.org/software/p/uMark/alternatives
https://watermark-image.en.softonic.com/...tives/free

Thanks for the previous reply. I have been using XnConvert for Numbering. I have ran into an issue. It always starts at number 1. Some images I need to start at a different number. I may have a batch I need to number from 10 to 20 for example. Is there a way to add the starting number in XnConvert or any other software? Thank you
Reply


Forum Jump: