Changing of pixel values after writing the same image using imwrite opencv python function
Question: 
    import cv2
    import numpy as np
    im=cv2.imread('test.jpg')
    cv2.imwrite('result.jpg',im)
    

Here test.jpg have size 19 KB and result.jpg have 41 KB even though they are
same images.

I observed that there is change in the pixel values of these two images.

How to prevent this one ?


Answer: Re-writing or 'saving' an image in any library or tool will always create a
new file or 'new pixel values'. This happens because the image is being
processed for saving at a certain quality. The saved image quality and size
depends on the library doing the save. So default values, depth, compression,
etc. need to be provided.

If you just want to create a copy of the image in a new file, either copy the
file directly via `sys` or binary read the whole file and write it to a new
one - without using any image processing libs.

