View Single Post
Old 08-03-2023, 08:42 AM   #1
snarkophilus
Wannabe Connoisseur
snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.snarkophilus ought to be getting tired of karma fortunes by now.
 
Posts: 426
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
compress_news_images and png images?

Would it be much work to make compress_news_images work for PNG files too? One news site I use has some 3-10MB PNG images that would be nice to resize like is already possible for JPG files.

I see that scale_image() in src/calibre/utils/img.py looks like it can deal with PNG files, but rescale_image() in src/calibre/web/fetch/simple.py only tries to rescale JPEG/JPG files. It looks like we convert anything that isn't PNG/JPEG/JPEG to these formats, so could it be as simple as changing the rescale check from
Code:
                    if self.compress_news_images and itype in {'jpg','jpeg'}:
to
Code:
                    if self.compress_news_images:
?

(I know enough python to be dangerous, but probably not be useful!)
snarkophilus is offline   Reply With Quote