realloc memory for image converter if format changed