You should read the documentation of the functions you're using if you want to understand them. Matlab has excellent documentation, it is one of the things that is better than most alternatives.
If you want to have the exact same image, you need to make sure there is no lossy compression in the file format and that you don't have any float rounding. The png format is lossless, so no problem there. If you want to store and retrieve images, they will generally be stored as uint8, instead of double. You haven't attached any example files to reproduce your issue, so I can't be more specific than this.
Also, you shouldn't shadow the internal image function with a variable name. That can in some cases cause issues. Before assigning a variable, you can use the which function to find out if the name is in use by a function you may need.