Call SaveToStream to copy the layer structure to AStream. Only the layers are copied, not the component itself.
This is how to copy the content of one ImagePainter to another:
MyStream : TMemoryStream;
MyStream := TMemoryStream.Create;
If you save the stream to a file, you should use the IPD extension, else you will get problems when reading it back with the LoadFromFile procedure.