begin implementation of getPixels subroutine