Please note this function doesn't return null right now, but you should still check for null anyway as that might change.
The returned MemoryImage is either a IndexedImage or a TrueColorImage, depending on the file's color mode. You can cast it to one or the other, or just call MemoryImage.getAsTrueColorImage which will cast and return or convert as needed automatically.
Greyscale pngs and bit depths other than 8 are converted for the ease of the MemoryImage interface. If you need more detail, try PNG and getDatastream etc.
Easily reads a png file into a MemoryImage