hi! I've searched the internets for this but everything I found was way too vague - is there a source code somewhere for taking a black/white grayscale image, and converting it into a 1/0 2D array (1-black, 0-white or the other way round)?
Maybe reverse engineer the process going into ascii art conversion software?
try searching open source ascii art software, look at the source, and see if that helps you with ideas of how to do adapt it to your situation.
See if that helps.