Convert UInt array to bitarray

You can take a look here for an efficient approach: I have: Vector{UInt8}. I need: BitVector

Accessing bitarrays element by element is going to be extremely inefficient, so you should try something else.

BTW, I think you probably want your output matrix to be 8x1280 instead of 1280x8. Julia Arrays are column major so neighbors along a column are next to each other in memory, and also linear indexing (which you are using) moves down columns.