Padding bytes (not necessarily 0) must be appended to the end of the rows in order to bring up the length of the rows to a multiple of four bytes. When the pixel array is loaded into memory, each row must begin at a memory address that is a multiple of 4.
以 26 x 26 的圖片來說,要在第 2 個 for loop 尾巴補值,補到 4 的倍數止。但是表頭還是描述 26 x 26,不過實際 size 是 26 x 28 的大小。
for row in range(26): for col in range(26): add R value add G value add B value # padding add value add value
沒有留言:
張貼留言