implemented image decoding