In the examples in this chapter we used a PNG overlay image (lossless compression) which was set over a JPEG image. If we use a JPEG or other lossy compressed image as the overlay, the lossy compression artifacts may cause smudges and other artifacts when overlaid.
This is shown in the example below, where a highly compressed image was overlaid into another. Even with a good composition algorithm the compression artifacts causes the green halo and other defects. To avoid this, we must use losslessly compressed images as overlays, or at least images compressed without too much loss of information.