JPEG to 2d array



I am trying to find an efficient way to read a jpeg into a 2d array.
I'd like to have a number represent each pixels.
.