Add bmpfile. Auto create target directories. Fix get_filename.