Batch Resizing and Date Stamping Photos

I have a photo frame that displays pictures from a USB stick. It is fairly low resolution (1024*600), and in order to pack as many pictures as possible on a low-capacity USB stick, I resize them. I also like to have the photo date and time displayed in a corner. Since I have thousands of photos, I cannot do this manually on at a time.

I found that ImageMagick could be used to accomplish this. It works from the command line with a lot of parameters. I created a Windows batch file to iterate through some folders and in one step resize and annotate with date and time and write the result to the USB stick. Here it is. (It iterates through subfolders 2012, 2013, 2014, 2015.)

SET convert=C:\Program Files\ImageMagick-6.9.3-Q16\convert.exe
SET destination=G:\Documents\Pictures
IF NOT EXIST %destination% MKDIR %destination%
FOR /D %%d IN (2012 2013 2014 2015) DO (
    PUSHD %%d
    ECHO *** Processing folder %%d ***
    FOR /R %%a in (*.jpg) DO (
		ECHO %%a | FINDSTR /I ".picasaoriginals" > NUL
		IF errorlevel 1 (
			ECHO Processing file: %%a to %destination%\%%~nxa
			"%convert%" "%%a" -adaptive-resize 1024x600 - | "%convert%" - -pointsize 16 -fill white -undercolor "#00000080" -gravity Southeast -annotate +0+0 " %%[exif:DateTimeOriginal] " "%destination%\%%~nxa"
		) ELSE (
			ECHO Skipped %%a

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s