Convert to the pgm format (the P2 version, not the P5 one; see "man pgm"). Then you have the pixels in a format that is trivial to work with. Example from the man page: ------------------ start file feep.pgm ------------- P2 # feep.pgm 24 7 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0 0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0 0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ------------------ end file feep.pgm ------------- You should possibly use max value 255 (not 15 as in the example) with your project. This nice format also makes it utterly trivial to create images using a few lines of about any computer language in existence. Helpful example: http://jjj.de/pari/write-pgm.gpi A warning: when starting with the jpeg format you get spurious results when doing anything in the frequency domain (unless the jpeg did not compress at all). Best, jj * James Propp <jamespropp@gmail.com> [Feb 26. 2014 08:29]:
Does anyone know a way to turn black and white jpeg images into rectangular arrays of pixel-by-pixel grayscale levels?
My Mac has Adobe Photoshop CS6 and Mathematica, but I can't figure out a way to get either of them to do it.
The reason I want to do this has to do with this year's Gathering for Gardner, so I believe it (just barely) qualifies as a math-fun topic.
Jim Propp _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com http://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun