Mx.recordio unpack_img and pack_img behaviour

Hi,
I run into strange behaviour with pack_img and unpack_img which I can not explain.
Why in the following case, I can not get the original image when I pass it sequentially to pack_img and then to unpack_img? Is it expected?

header = mx.recordio.IRHeader(0, 1, 1, 0)
img = np.ones((5, 5, 3), np.int) * 125
img[0][0][0] = 0.0
packed_s = mx.recordio.pack_img(header, img, quality=100)
img_decoded = mx.recordio.unpack_img(packed_s)
assert(np.array_equal(img, img_decoded[1])). /// it fails

when I change the values of all channel, it works almost:

  header = mx.recordio.IRHeader(0, 1, 1, 0)
    img = np.ones((5, 5, 3), np.int) * 125
    img[0][0][0] = 0.0
    img[0][0][1] = 0.0
    img[0][0][2] = 0.0
    packed_s = mx.recordio.pack_img(header, img, quality=100)
    img_decoded = mx.recordio.unpack_img(packed_s)
    assert(np.array_equal(img, img_decoded[1])) //it fails

I have small difference (125 vs 124) on 2 pixels (3,3) and (4,4) on the three channels!

Thank you for the help

HI all,
I think I can answer to my question ;-). I ve found that pack_img actually encode the array into a jpeg format (by default) which is lossy file format. if I use the following:
packed_s = mx.recordio.pack_img(header, img, quality=100, img_fmt='.png')
I finally have the result expected.