Image data related functions fix first commit. Needs more testing.
Merge pull request #1 from jrouault/fix/putImageData

Image data related functions fix first commit. Needs more testing.