Closed Dapbler closed 6 years ago
Something like : identify -precision 16 -format "%b %e %m %W %H" infile size checks, max size of 700KB x aspect ratio? convert infile -quality 40 -resize "x1500>" outfile if smaller replace
Done. Pretty aggressive conversion, usually shrinking by 50-90% while still looking okay.
Remember this is not something to do on the archival copy/original purchased download. This compresison loses image quality, so it's just for the copy placed on a low storage device (phone, tablet).
Phones and tablets with small screens really don't need great resolution and image quality and often don't have a lot of storage. JPEG module is gone in Py3.x and PIL says it's 2.x only. Imagemagick is fine on *nix.
Maybe check each page against a max width/height and size (KB), and convert if outside of boundaries.