I've just discovered an absurdly powerful PNG optimization tool: PNGout (
Original page,
Linux port)
I clearly don't have the level to implement it inside calibre, but damn it's really powerful, so I'll share the info if you want to use it.
Also, I think you could add an
optimize_images command in the "setup.py" that will run PNGout and then OptiPNG on all PNG, so this optimization can be done entirely autonomously, without having to use the ImgBot service.
(note:
optimize_images instead a
optimize_png because we could extend it later to other images optimization, like SVG... but later... when there's the motivation to it)