To compress EPUB and the formats beside it, start with the screen: an e-reader shows a picture no wider than its own. Illustrations saved at camera size are resized to the reader you pick and re-encoded; leftovers from calibre, iTunes and macOS are dropped. Chapters, styling and the table of contents are copied byte for byte.
The three sample books compressed at each preset in this browser. Each row is the new size and how much smaller it is; the bar is how much of the original is left.
Each format stores pictures differently, which decides what can be done to it without touching the text.