Fix monochrome inversions not respecting the Pixel Format of the image.

The pixel format of the image is being ignored  in the monochrome
conversions causing bad conversions for images that are not 8bpp.