initialize output to size of bounding box. extract function