Transfer GRAYSCALE_1BPP and RGB_24BPP arrays when possible.

I measured three documents where this optimization has an effect. The peak RSS value change like so:
- ~660 MiB --> ~615 MiB
- ~293 MiB --> ~270 MiB
- ~455 MiB --> ~430 MiB