take_pic() now takes the picture data array, width and height as parameters.