tests and fixes for decodeSync
simplify pixel math by changing the type
methods for converting color format