add png in simple.py for copress_news_images

by adding png for copression the size of some magazines will be decreased up to 10 times. worked for me well, so I wanted to provide the setting for all.
This commit is contained in:
MasterPlexus 2024-11-08 21:37:00 +01:00 committed by GitHub
parent 37dd0f5c70
commit cef6ee1a93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -460,7 +460,7 @@ class RecursiveFetcher:
if itype not in {'png', 'jpg', 'jpeg'}: if itype not in {'png', 'jpg', 'jpeg'}:
itype = 'png' if itype == 'gif' else 'jpeg' itype = 'png' if itype == 'gif' else 'jpeg'
data = image_to_data(img, fmt=itype) data = image_to_data(img, fmt=itype)
if self.compress_news_images and itype in {'jpg','jpeg'}: if self.compress_news_images and itype in {'png','jpg','jpeg'}:
try: try:
data = self.rescale_image(data) data = self.rescale_image(data)
except Exception: except Exception: