Florida Museum of Natural History
[Herbarium Collections Catalog]

UNIVERSITY OF FLORIDA HERBARIUM
COLLECTION CATALOG : Image Processing Batch Files

A collaborative project with the George A. Smathers Libraries Digital Library Center and the Florida Center for Library Automation.

[University of Florida Herbarium]

[Imaging Flow Sheet]

imageprocesswith_imagemag_onProjects_with_file_copy_bk_withshut.bat

:: variables
SET /P ShutDown=Enter Y to shutdown when done:

REM Lower case all .tif files in P:\kentp\imagesprocessing\
CALL C:\batchfiles\imageprocess_lowercase_imagesprocessing_tif.bat

REM move nonsecure files to their own directory
move "P:\kentp\imagesprocessing\*secure.*" "P:\kentp\imagesprocessing\nonsecure\"

REM make thumbnails
"C:\Program Files\Easy Thumbnails\EzThumbs.exe" "P:\kentp\imagesprocessing\*.tif" /D="P:\kentp\imagesprocessing\tn\" /P="tn_" /W=100 /H=75 /Z=ShrinkToFit /F=Bicubic /Q=100 /B=0 /C=0 /S=+7 /R=0 /L

REM Sharpen and Make jpg with Imagemagick
FOR %%f IN ("P:\kentp\imagesprocessing\*.tif") DO ( "C:\Program Files\ImageMagick-6.4.5-Q16\convert.exe" -sharpen 1.0x0.0 "%%f" "P:\kentp\imagesprocessing\zoom\%%~nf.jpg" )

REM Create zoomify batch file
CALL C:\batchfiles\zoomcreatebatch_onProjects.bat

REM make the zooms
CALL C:\batchfiles\zoombatch.bat

REM move jpg from zoom to jpg folder
move "P:\kentp\imagesprocessing\zoom\*.jpg" "P:\kentp\imagesprocessing\jpg\"

:: copy to files to web server folders
CALL C:\batchfiles\image_process_copy_files_bitkinex.bat
IF %ShutDown%==Y shutdown -s

imageprocess_lowercase_imagesprocessing_tif.bat

Lower cases all *.tif file names in imageprocessing folder.

For /F "tokens=*" %%F In ('Dir /B /L P:\kentp\imagesprocessing\*.tif') Do (Move P:\kentp\imagesprocessing\"%%F" P:\kentp\imagesprocessing\"%%F")

zoomcreatebatch_onProjects.bat

Creates a batch file that will process *.jpg to Zoomify image folders.

ECHO REM Zoombatch > C:\batchfiles\zoombatch.bat
FOR %%f IN ("P:\kentp\ImagesProcessing\zoom\*.jpg") DO ( ECHO C:\zoomify\zoomify.exe "%%f" >> C:\batchfiles\zoombatch.bat ECHO DEL "%USERPROFILE%\Local Settings\Temp\Ztemp.Temp" >> C:\batchfiles\zoombatch.bat )

zoombatch.bat

Batch file for processing existing *.jpg to Zoomify image folders.

REM Zoombatch (SAMPLE FILE, VARIES BASED ON IMAGES TO PROCESS)
C:\zoomify\zoomify.exe "P:\kentp\ImagesProcessing\zoom\100318a1.tif"
DEL "C:\Documents and Settings\kperkins\Local Settings\Temp\Ztemp.Temp"
C:\zoomify\zoomify.exe "P:\kentp\ImagesProcessing\zoom\100546a1.tif"
DEL "C:\Documents and Settings\kperkins\Local Settings\Temp\Ztemp.Temp"

image_process_copy_files_bitkinex.bat

Copies Zoomify files to appropriate folders on web server. Works for the following files:
number plus single letter plus single number (e.g., 123a1, 123456a1)
P plus number plus single letter plus single number (e.g., P123a1)

echo THIS FILE WILL NOT HANDLE SLIDES OR FILES WITH EXTRA LETTERS!
:: @echo off

:: variables
:: these could be sent as parameters???
set copyzoomcmd="C:\Program Files\bitkinex\bitkinex.exe" cp /noinfo /binary /skiptmsz /force /auto_exit
set copytncmd="C:\Program Files\bitkinex\bitkinex.exe" cp /noinfo /binary /skiptmsz /force /auto_exit
set tnsourcedrive=P:
set tnsourcefolder=%tnsourcedrive%\kentp\imagesprocessing\tn
set tndestinationdrive="bitkinex://http/WebDav|HerbariumImages|/dav/herbarium/specimens/images
set tndestinationfolder=%tndestinationdrive%/tn
set zoomsourcedrive=P:
set zoomsourcefolder=%zoomsourcedrive%\kentp\imagesprocessing\zoom
set zoomdestinationdrive="bitkinex://http/WebDav|HerbariumImages|/dav/herbarium/specimens/images
set zoomdestinationfolder=%zoomdestinationdrive%/zoom

:: Lower case thumbnails to be safe
For /F "tokens=*" %%F In ('Dir /B /L %tnsourcefolder%\tn_*.jpg') Do (Move %tnsourcefolder%\"%%F" %tnsourcefolder%\"%%F")

:: Process tn files beginning with P (Pteridophytes)
%tnsourcedrive%
cd %tnsourcefolder%
FOR %%f IN (tn_p*.jpg) DO (CALL :ProcessPteridophyteTN %%f)
:: Process tn files beginning with a number 1-9 (Vaculars)
FOR %%f IN (tn_1*.jpg tn_2*.jpg tn_3*.jpg tn_4*.jpg tn_5*.jpg tn_6*.jpg tn_7*.jpg tn_8*.jpg tn_9*.jpg) DO (CALL :ProcessNumericTN %%f)
:: need to deal with slides manually at this time
:: Process zoom folders beginning with P (Pteridophytes)
%zoomsourcedrive%
cd %zoomsourcefolder%
FOR /D %%d IN (p*) DO (CALL :ProcessPteridophyteZooms %%d)
:: Process zoom folders beginning with a number 1-9 (Vaculars)
FOR /D %%d IN (1* 2* 3* 4* 5* 6* 7* 8* 9*) DO (CALL :ProcessNumericZooms %%d)
:: need to deal with slides manually at this time
GOTO :EOF

:ProcessPteridophyteZooms
:: -----------------------------------------------
:: ProcessPteridphyteZooms subroutine starts here
:: current directory passed as variable. e.g.=p1001a1
set curdir=%1
:: lop off last 2 characters which are typically a1. e.g.=p1001
set curdir2=%curdir:~0,-2%
:: lop off leading p. e.g.=1001
set curdir3=%curdir2:~1%
:: add three zeros to front. e.g.=0001001
set curdir4=000%curdir3%
:: take the last 5 characters. e.g.=01001
set curdir5=%curdir4:~-5%
:: take the first 2 characters and add a p. e.g.=p01
set curdir6=p%curdir5:~0,2%
:: copy, i.e. move the folders
%copyzoomcmd% %zoomsourcefolder%\%curdir% %zoomdestinationfolder%/%curdir6%/"
:: End of ProcessPteridophyteZooms
GOTO :EOF

:ProcessNumericZooms
:: -----------------------------------------------
:: ProcessNumericZooms subroutine starts here
:: current directory passed as variable. e.g.=1000a1
set curdir=%1
:: lop off last 2 characters which are typically a1. e.g.=1000
set curdir2=%curdir:~0,-2%
:: remove all other alphabetic letters
set curdir2a=%curdir2:a=%
set curdir2b=%curdir2a:b=%
set curdir2c=%curdir2b:c=%
set curdir2d=%curdir2c:d=%
set curdir2e=%curdir2d:e=%
set curdir2f=%curdir2e:f=%
set curdir2g=%curdir2f:g=%
:: add five zeros to front. e.g.=000001000
set curdir3=00000%curdir2g%
:: take the last 6 characters. e.g.=001000
set curdir4=%curdir3:~-6%
:: take the first 3 characters. e.g.=001
set curdir5=%curdir4:~0,3%
:: curdir5 is the folder name. e.g.=001
:: copy the files
%copyzoomcmd% %zoomsourcefolder%\%curdir% %zoomdestinationfolder%/%curdir5%/"
:: End of ProcessNumericZooms
GOTO :EOF

:ProcessPteridophyteTN
:: -----------------------------------------------
:: ProcessPteridphyteTN subroutine starts here
:: current file passed as variable. e.g.=tn_p1001a1
set curtnfile=%1
:: lop off last 6 characters which are typically a1.jpg e.g.=p1001
set curdir2=%curtnfile:~0,-6%
:: lop off leading tn_p. e.g.=1001
set curdir3=%curdir2:~4%
:: add three zeros to front. e.g.=0001001
set curdir4=000%curdir3%
:: take the last 5 characters. e.g.=01001
set curdir5=%curdir4:~-5%
:: take the first 2 characters and add a p. e.g.=p01
set curdir6=p%curdir5:~0,2%
:: copy, i.e. move the folders
%copytncmd% %tnsourcefolder%\%curtnfile% %tndestinationfolder%/%curdir6%/%curtnfile%"
:: End of ProcessPteridophyteTN
GOTO :EOF

:ProcessNumericTN
:: -----------------------------------------------
:: ProcessNumericTN subroutine starts here
:: current file passed as variable. e.g.=tn_1000a1
set curtnfile=%1
:: lop off last 6 characters which are typically a1.jpg e.g.=tn_1000a1.jpg=tn_1000
set curdir2=%curtnfile:~0,-6%
:: lop off first tn_ e.g 1000
set curdir3=%curdir2:~3%
:: remove all other alphabetic letters
set curdir3a=%curdir3:a=%
set curdir3b=%curdir3a:b=%
set curdir3c=%curdir3b:c=%
set curdir3d=%curdir3c:d=%
set curdir3e=%curdir3d:e=%
set curdir3f=%curdir3e:f=%
set curdir3g=%curdir3f:g=%
:: add five zeros to front. e.g.=000001000
set curdir4=00000%curdir3g%
:: take the last 6 characters. e.g.=001000
set curdir5=%curdir4:~-6%
:: take the first 3 characters. e.g.=001
set curdir6=%curdir5:~0,3%
:: curdir6 is the folder name. e.g.=001
:: copy the files
%copytncmd% %tnsourcefolder%\%curtnfile% %tndestinationfolder%/%curdir6%/%curtnfile%"
:: End of ProcessNumericTN
GOTO :EOF

:EOF
:: The End of processing batch

image_process_create_fill_Processed_folder.bat

Creates a folder named ImagesProcessed[number] with jpg, nonsecure, tn, and zoom subfolders.
Moves image files and zoomify directories in ImagesProcessing to that folder.


:: Make images processed folder
@echo off

:: variables
SET /P ProcessedInput=Enter the number for the processed folder:

IF %ProcessedInput% EQU 0 GOTO EOF

SET /A ProcessedNumber="%ProcessedInput%"*1
IF %ProcessedNumber% EQU 0 GOTO EOF
:: IF %ProcessedNumber% GTR 0 ECHO UserInput "%ProcessedNumber%" is a number
IF NOT EXIST P:\kentp\ImagesProcessed%ProcessedNumber% GOTO MakeFolder
GOTO EOF

:MakeFolder
md P:\kentp\ImagesProcessed%ProcessedNumber%
md P:\kentp\ImagesProcessed%ProcessedNumber%\jpg
md P:\kentp\ImagesProcessed%ProcessedNumber%\nonsecure
md P:\kentp\ImagesProcessed%ProcessedNumber%\tn
md P:\kentp\ImagesProcessed%ProcessedNumber%\zoom

:: Move imageprocessing files
SET /P MoveImageProcessing=Enter Y to move image processing files:
IF NOT %MoveImageProcessing%==Y GOTO EOF
move P:\kentp\imagesprocessing\jpg\*.* P:\kentp\ImagesProcessed%ProcessedNumber%\jpg\
move P:\kentp\imagesprocessing\nonsecure\*.* P:\kentp\ImagesProcessed%ProcessedNumber%\nonsecure\
move P:\kentp\imagesprocessing\tn\*.* P:\kentp\ImagesProcessed%ProcessedNumber%\tn\
move P:\kentp\imagesprocessing\*.* P:\kentp\ImagesProcessed%ProcessedNumber%\
:: move zoom folders
P:
cd P:\kentp\imagesprocessing\zoom\
FOR /D %%d IN (*) DO (move P:\kentp\imagesprocessing\zoom\%%d P:\kentp\imagesprocessed%ProcessedNumber%\zoom)
:EOF
pause

[top of page]
Page last updated: 1 May 2013
Copyright ©, 1995-2014 University of Florida Herbarium / Florida Museum of Natural History