Add test code for MOAIImage. Bug fixes.

See #1003