JPG files don't work that way
. JPG is a big exception. JPG compression is not lossless. JPG compression is lossy. Lossy means "with losses" to image quality. JPG compression has very high efficiency (relatively tiny files) because it is intentionally designed to be lossy, designed to give very small files without the requirement for full recoverability. JPG modifies the image pixel data (color values) to be more convenient for its compression method. Tiny detail that doesn't compress well (minor color changes) can be ignored (not retained). This allows amazing size reductions on the remainder, but when we open the file and expand the data to access it again, it is no longer the same data as before. This lost data is like lost purity or integrity. It can vary in degree, it can be fairly good, but it is always unrecoverable corruption of the data.
This makes JPG be quite different from all the other usual file format choices. This will sound preachy, but if your use is critical, you need a really good reason to use JPG.