Fix previous image references in OptimizeImageLayers (#983)
The code used CloneImage with columns and rows arguments to create
previous image references.
However, the documentation of CloneImage says:
> If the specified columns and rows is 0, an exact copy of the image is
> returned, otherwise the pixel data is undefined and must be initialized
> with the QueueAuthenticPixels() and SyncAuthenticPixels() methods. On
> failure, a NULL image is returned and exception describes the reason for the
> failure.
Therfore, the pixel data given by such a statement was undefined, which is
not expected.
This alters those arguments to 0, or replaces CloneImage with
ReferenceImage if it is enough.