Image objects are pointers toward C++ objects
stored in memory. When copying an Image object using an
assignment operator, this creates a copy of the pointer, but not a copy of
the C++ object. Any operation on the copied Image object will
therefore result in a modification of the orginal Image object.
This function duplicates the original Image object instead,
allowing safe operations on it while maintaining the integrity of the
original Image object.