Add test case for outdir attribute
Ensure image target directory exists before attempting to write file