Add a function to subsample pixel data.