Implemented algorithm methods 1 and 2 with JS-decoded images.