I have a list that contains the RGBA
color data for a 1024*1024
image, meaning 4,194,304
integers in that list. I need to split it down into 1024
sub-lists with each of those having 1024
sub-lists containing the 4 channels in order to be able to use it for what I need.
I have tried using for loops to append data to new lists, but that is a very slow process. I just need the list to be divided every 4 integers. What is the most efficient way of doing this? I have numpy if that can be used for this somehow.
I suppose I should mention that the list comes from unpacking a struct
from a .raw
image, so if there is a way to have the list split upon creation while unpacking that would also work.