Add normalizeFormat() method in GD driver

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