Resolved issue #546. Output format parsing from filename extension.

Instead of explicitly specify the output format type, we can learn it from the file extension.