adding text to JPEGs, in bulk
Mikkel L. Ellertson
mikkel at infinity-ltd.com
Sat Sep 16 15:49:22 UTC 2006
Tim wrote:
>
> I think I can work out how to handle a batch of files to add consistent
> text, now. But I haven't worked out how I could extract "256" from a
> filename like "img_0256.jpg", yet. The filenames are all the same
> length, so there's got to be some tool that'll let me strip characters
> 7, 8 & 9 out of the name.
>
Take a look at the cut command. As an example, look at:
echo 12345678 | cut -b3-5
The output will be 345. (bytes 3 through 5) If you did:
echo abcdefgh | cut -b4-8
you would get defg as your output.
Or in a script:
for i in *.jpg ; do
number=$(echo $i | cut -b7-9)
echo $number
done
Mikkel
--
Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!
More information about the users
mailing list