Fixed closing bracket issue when writing to image to disk. Converted back to type int rather than uin8 as bad results occurred from overflow.