Trying to figure out why the last pixel is cut sometimes for monochrome images