Fix an encoder bug for odd-width images