Add normalizeFormat() method in GD driver

Makes code less confusing by separating concerns (and avoiding pass-by-reference).
Small fixes

Fixes a typo, removes an useless array entry.