simonw / shot-scraper

A command-line utility for taking automated screenshots of websites
https://shot-scraper.datasette.io
Apache License 2.0
1.67k stars 73 forks source link

Add a scale factor option #133

Closed nielthiart closed 8 months ago

nielthiart commented 9 months ago

Adds the --scale-factor option.

Ref #136

The --scale-factor option allows users to specify a specific device scale factor as a float.

This is useful for testing specific high-definition displays. For example, the Google Pixel 6 has a pixel ratio of 2.625. Some modern phones have pixel ratios of 4.

I needed this for screenshots I'm taking, so thought it might be useful as a feature.

The existing --retina option is a specific case of the new --scale-factor option.

Includes a validation to prevent conflicts when using the --scale-factor and --retina options together. There is #129 that introduces the --device option with some overlap here. The --device option would also need to be mutually exclusive with --scale-factor.


📚 Documentation preview 📚: https://shot-scraper--133.org.readthedocs.build/en/133/

simonw commented 8 months ago

This PR is flawless. Thanks very much!