Preallocate image array