MemoryImageExample -- creating an image from raw pixel data.

This example creates a 29-by-29 array of pixels and displays it in an image magnified by a factor of 8. The pixel indices progress from left to right in a row, and from higher row to lower row.

The pixels have red turned on if the index is divisible by 2, green turned on if the index is divisible by 3, and blue turned on if the index is divisible by 5. Note, for instance, that every thirtieth pixel is white (divisible by 2, 3, and 5) and is surrounded by black pixels (index divisible by NONE of 2, 3, and 5).



The source.