Here are some examples for image compression on-the-fly with size comparison before and after compression.
JPEG is a lossy image compression algorithm, which means that JPEG affects the visual precision of the compressed image. In Inteliver JPEG compression API, you can set the compression level (image quality) from a range of [0, 100].
Level zero result in a very small image size while affecting the visual precision alot. Level one hundred will result in the best quality image with biggest size.
PNG is a lossless image compression algorithm. The PNG compression will not affect the visual precision of the image and after decoding the compressed image is identical to the original one. Hoewever, the compression level is a trade-off between file size and encoding/decoding speed.
In Inteliver PNG compression API, you can set the compression level from a range of [1, 9] where level-1 produces the biggest file size and fastest decoding mode and level-9 result in the samllest file size with the slowest decoding time.