ClarkVision.com

To Clarkvision.com Galleries

Digital Workflow Simple Image Database Scripts

http://www.clarkvision.com/articles/digitalworkflow/scripts.html

R. N. Clark Email contact (is encoded to prevent spam):
has the following form: username@qwest.net where
username is rnclark

All images, text and data on this site are copyrighted.
They may not be used except by written permission from Roger N. Clark.
All rights reserved.


Here are some simple unix/linux scripts for creating your own image database. You can get unix tools for windows machines from a number of sources. A search of the database on a 3 GHz GHz I7 PC takes fraction of a second. For example, in 2016, my command "findimage family" returns 61,263 images in 0.17 second searching over 58,2464 images. Example: "findimage alaska eagle" finds 800 entries, whereas "findimage eagle" finds 1562 images.

Here are the scripts:

creates database:

Script for windows machines with linux tools, disks c: d: e:

#!/bin/sh
f=disk.listing.01.08.2006.txt
find c: d: e: -exec ls -ld {} \; > $f
o=imagedatabase.01.08.2006.txt
date > $o
for i in .gif .jpg .tif .psd .crw .cr2
do
        grep -i ${i}\$ $f >> $o
done

Script for linux/unix machines, disks (or directories): /a1 /a2 /photos

#!/bin/sh
f=disk.listing.01.08.2006.txt
find /a1 /a2 /photos  -exec ls -ld {} \; > $f
o=imagedatabase.01.08.2006.txt
date > $o
for i in .gif .jpg .tif .psd .crw .cr2
do
        grep -i ${i}\$ $f >> $o
done

Query the database (put script in file called findimage):

Script for windows machines with linux tools,

#!/bin/sh
f=C:/imagedatabase/imagedatabase.01.08.2006.txt
grep -i ${1-.} $f | grep -i ${2:-.} | grep -i ${3:-.}

Script for linux/unix machines:

#!/bin/sh
f=/imagedatabase/imagedatabase.01.08.2006.txt   # full path to the database
grep -i ${1-.} $f | grep -i ${2:-.} | grep -i ${3:-.}

The 3 greps allow three search words (you can obviously extend this as much as you want).


Home Page: ClarkVision.com

First Published January 2005.
Last updated November 04, 2016