A PDF page does not store an image's pixels directly inside its own content. Instead, the page contains an instruction that essentially says draw the image that lives in object 47 at this position, and object 47 is stored separately elsewhere in the file as what is called an image XObject. Every place across every page that uses that image points at the same object, rather than each place storing its own copy. That structure is exactly what makes replacing an image safe and precise. Recompressing an image means swapping out what object 47 contains, and every page that already pointed at object 47 automatically shows the new, smaller version, with no need to find and rewrite the page content itself.
This is also why the rest of the document is guaranteed to stay untouched. Text is stored as its own separate kind of object, fonts are embedded as their own objects, vector graphics and page dimensions are unrelated structures entirely. None of that is walked or modified by this tool, only the specific objects that are image data and that pass the safety checks described above ever get rewritten.
Why some images are left alone rather than compressed anyway
It would be technically possible to attempt every embedded image regardless of its format, decoding a scanned fax-style image with a fragile, unofficial method, or converting a CMYK photograph to RGB with an approximate formula. Both of those would sometimes work and sometimes produce a subtly broken or discolored result, and there is no way to tell which case you are in until after the fact. Skipping those categories entirely, and saying so plainly in the results, is the more honest choice. A PDF you can trust the output of is worth more than a slightly bigger file that compressed everything, including the images that were never safe to touch in the first place.
If your PDF is a scanned document and this tool reports most of its images as skipped, that is expected rather than a bug, and a general purpose PDF tool that promises to handle every possible embedded format is making a promise it likely cannot keep reliably either. For photo-heavy PDFs, brochures, reports, anything built from embedded JPEGs rather than scanned pages, this tool handles the common case directly and the results are usually substantial. If you're starting from loose photos rather than an existing PDF, you can also combine images into a PDF first, or compress a standalone photo before it ever gets embedded, which avoids the CMYK and mask-skipping edge cases entirely since you're working with the source file directly. If you just need to pull individual pages back out as images afterward, that's what PDF to Images is for, and the metadata viewer can confirm the exact dimensions of any extracted image.