AlexJF / pelican-advthumbnailer

Plugin for Pelican to allow flexible generation of thumbnails.
Apache License 2.0
7 stars 7 forks source link

Trying to generate slightly smaller image files by using optimisation parameters #7

Closed victordomingos closed 2 years ago

victordomingos commented 6 years ago

Replaced this line:

            thumbnail.save(path)

...with these:

            try:
                thumbnail.save(path, quality=70, optimize=True, progressive=True)
            except IOError:
                PIL.ImageFile.MAXBLOCK = img.size[0] * img.size[1]
                img.save(path, quality=70, optimize=True, progressive=True)
linevych commented 6 years ago

Hardcoding things is bad, it will more useful to pass pelican object to Thumbnailer and make optimization settings configurable.

victordomingos commented 6 years ago

I see. Also, I believe it would be a good idea to include a way to turn on and off optimisation and the quality value in the pelican settings file.

AlexJF commented 2 years ago

I'll add the settings, sorry for the delay 😅