3

I am currently going through the PSET 4 sheet and have just read up to the part where it is being explained that if the number of bytes in each scan line is not a multiple of 4 then it is padded out. I can't get my head around why this padding is required though ? What is the significance of having each scan line as a multiple of 4 bytes? I'm assuming there is a simple reason that I am overlooking but nothing obvious stands out to me at the moment.

Anyone able to help explain this for me or at least point me in the right direction ?

3

Row size is a DWORD ie 32 bits/4 bytes. So a the 24 bit pixels must be padded to fit. See also this answer in Stack Overflow...

"Because 24 bits is an odd number of bytes (3) and for a variety of reasons all the image rows are required to start at an address which is a multiple of 4 bytes."

https://stackoverflow.com/questions/2601365/padding-in-24-bits-rgb-bitmap

You must log in to answer this question.

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