TIFF output output when 'tiled' and 'separate' - fix buffer overwrite.

TIFF output output when 'tiled' and 'separate' - fix buffer overwrite that would corrupt pixel values.

Not only do I allocate a separate buffer now, but I also put in smarts
to store it on the stack when reasonable size, dynamically allocate when
it's big, which should be a minor speed gain for the usual case.