Do createImageData/putImageData in chunks, to save memory.
Merge pull request #4138 from nnethercote/chunk-ImageData

Do createImageData/putImageData in chunks, to save memory.