0

Actually I didn't understand the steps to complete resize.c and I'm completely lost, so I had to do some guesses about it.

I was able to get the right height and width of an image but the problem still with colors and padding.

this is what I did width the code

bf.bfSize *= n;
bi.biWidth = abs(bi.biWidth) * n;
bi.biHeight =abs(bi.biHeight) * n;
bi.biSizeImage *= n;

1 Answer 1

1

1) The way you're calculating the headers (bfSize and biSizeImage) is wrong. Look into the MSDN pages for a full explanation and use the tools provided by the staff (xxd, peek, etc.) with the staff's implementation, to see how the headers change when the file is resized.

2) You need the whole part in which you read and write the files. Use copy.c as a template for that. Keep in mind that copy.c makes a perfect copy of the input bmp file, so what you need to do is add the part in which you resize the bytes. Make sure you understand everything that copy.c does. It makes no sense to even begin with resize if you don't understand it. If you have any specific questions about bits of code from copy.c, ask them here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .