To fix the problem simply set the image depth to 8
before you write it or use the Q8 version of ImageMagick. If you use the Q16 version of ImageMagick and resize an 8-bit image, it produces a 16-bit image because new colors are being introduced during the scaling operation.