build PImage return function, seperate pixel processing and PImage creation