Cleanup previous PR

This commit is contained in:
Kovid Goyal 2024-11-09 08:01:09 +05:30
parent 00d4214857
commit 8eb9e37d99
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 3 deletions

View File

@ -366,11 +366,12 @@ class BasicNewsRecipe(Recipe):
ignore_duplicate_articles = None
# The following parameters control how the recipe attempts to minimize
# JPEG image sizes
# image sizes. Note that if compression is enabled PNG images are converted
# to JPEG.
#: Set this to False to ignore all scaling and compression parameters and
#: pass images through unmodified. If True and the other compression
#: parameters are left at their default values, JPEG images will be scaled to fit
#: parameters are left at their default values, images will be scaled to fit
#: in the screen dimensions set by the output profile and compressed to size at
#: most (w * h)/16 where w x h are the scaled image dimensions.
compress_news_images = False

View File

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