Page 1 of 1
Lookup tables
Posted: 2013-11-12T03:23:39-07:00
by calder
I'm very new to ImageMagick (Windows), and am making good progress with the things I need to use it for.
There is one item I can't resolve. I have 1300 pictures that I want to annotate with an individual ID. The IDs are in a table, and have the filename in an adjacent column.
I'd like to be able to lookup the filename and get the ID, then annotate the appropriate image. But I can't see a method, if indeed one does exist.
I'd welcome suggestions....TIA
Paul
Re: Lookup tables
Posted: 2013-11-12T03:52:23-07:00
by snibgo
Can you figure out the annotate command? The rest is just scripting. I'd read the file with a "for" loop to get the filename and id into two variables. Then use those varables in a "convert" within the for loop.
Re: Lookup tables
Posted: 2013-11-12T11:05:45-07:00
by fmw42
What platform and IM version? The syntax for scripting depends upon your platform.
Re: Lookup tables
Posted: 2013-11-12T12:50:36-07:00
by calder
Thanks for the replies.
Yep, I've figured out annotate, but reading the external file has me foxed! A few hints would be helpful...
I was not sure of the best version - the one I eventually chose was 6.8.7.5-Q16 on Windows 8.1. Was that a reasonable one?
Paul
Re: Lookup tables
Posted: 2013-11-12T14:24:35-07:00
by calder
Ah, nothing like answering your own questions
xxxxx.txt is a renamed .csv file, so....
@echo off
setlocal enabledelayedexpansion
for /f "tokens=1,2 delims=," %%a in ('type xxxxx.txt') do (
set line=%%a
echo !line!
set line=%%b
echo !line!
)
gets me the two variables. Now to figure out the rest.
Paul
Re: Lookup tables
Posted: 2013-11-12T14:53:54-07:00
by Bonzo
Now you have that you might find something useful on my website:
http://www.rubblewebs.co.uk/imagemagick/batch.php
Re: Lookup tables
Posted: 2013-11-12T16:27:02-07:00
by calder
Thank you.
Paul
Re: Lookup tables
Posted: 2013-11-12T19:18:54-07:00
by snibgo
Yes, that's it. Well, "type" isn't needed.
Code: Select all
for /f "tokens=1,2 delims=," %%a in (xxxxx.txt) do (
convert %%b -annotate 0 "%%a" newdir\%%b
)
Re: Lookup tables
Posted: 2013-11-12T21:35:39-07:00
by calder
Cheers....
Paul