Fix support for formats other than png.