use single buffer for image data instead of 2dim matrix