Use ImagesToBlob instead of ImageToBlob

ImageToBlob will implicitly flatten stacks of images instead of writing out every image in the stack. This is most noticable when writing out animated GIFs. As far as I can tell, this doesn't affect anything other than treating stacks of >1 image correctly, but a bunch of the tests fail even without this patch applied.