I've been struggling with pset4 resize.c for a while now and I think I'm getting close to finishing :) When resizing everything seems to visually work out, but when using 'peek', the headers don't correlate to the correct numbers, mainly in biSizeImage and subsequently bfSize. Below the code that I've used for the headers, I hope anyone can see what I did and how I can improve this!
BITMAPFILEHEADER nbf = bf;
BITMAPINFOHEADER nbi = bi;
nbi.biHeight *= N;
nbi.biWidth *= N;
// determine padding for scanlines
int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
int npadding = (4 - (nbi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
nbi.biSizeImage = (((bi.biSizeImage - padding*bi.biHeight) * (N * N)) + npadding*nbi.biHeight);
nbf.bfSize = nbi.biSizeImage + 54;