maaaaz / webscreenshot

A simple script to screenshot a list of websites
GNU Lesser General Public License v3.0
654 stars 162 forks source link

Add image output format and quality support #23

Closed manuelbua closed 4 years ago

manuelbua commented 5 years ago

This pull request adds support for user-specified output image format and quality: PhantomJS already supports this, so it was only a matter of passing it the correct parameters.

Two optional arguments have been added to the Python main driver:

The default file format has not changed and it's still png, this to avoid breaking other tools that may be based on webscreenshot.

By simply switching to jpg and making use of the default quality at 70, the space being used by hundred of images will now decrease up to ~70% in my tests, sometimes even higher (ie. 50 screenshots, png size is ~42Mb, jpg size is ~10Mb - Yahoo homepage, png size if 1.8Mb, jpg size is 400Kb).

maaaaz commented 4 years ago

Super cool contribution, thank you @manuelbua ! I just defined the default quality to 75, which is the PhantomJS default one