Implemented the "DecodeImage" function, however it does not work yet ;)