Lookup tables

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
calder
Posts: 5
Joined: 2013-11-12T02:18:15-07:00
Authentication code: 6789

Lookup tables

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Lookup tables

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Lookup tables

Post by fmw42 »

What platform and IM version? The syntax for scripting depends upon your platform.
calder
Posts: 5
Joined: 2013-11-12T02:18:15-07:00
Authentication code: 6789

Re: Lookup tables

Post 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
calder
Posts: 5
Joined: 2013-11-12T02:18:15-07:00
Authentication code: 6789

Re: Lookup tables

Post by calder »

Ah, nothing like answering your own questions :shock:

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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Lookup tables

Post by Bonzo »

Now you have that you might find something useful on my website: http://www.rubblewebs.co.uk/imagemagick/batch.php
calder
Posts: 5
Joined: 2013-11-12T02:18:15-07:00
Authentication code: 6789

Re: Lookup tables

Post by calder »

Thank you.

Paul
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Lookup tables

Post 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
)
snibgo's IM pages: im.snibgo.com
calder
Posts: 5
Joined: 2013-11-12T02:18:15-07:00
Authentication code: 6789

Re: Lookup tables

Post by calder »

Cheers....

Paul
Post Reply