Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple output images with different options #109

Open
paulhammond opened this issue Mar 26, 2020 · 2 comments
Open

Multiple output images with different options #109

paulhammond opened this issue Mar 26, 2020 · 2 comments
Labels
Milestone

Comments

@paulhammond
Copy link
Owner

In #66 Norm and I hashed out a possible spec for a new way of specifying output images on the command line. To quote it:


  • name: (has to be first) the filename for the image. We possibly allow %s (sanitized url) %x (md5 sum) etc. Or we expect people to provide their own filenames when they are capturing multiple pages. If there are no other options and the name does not start with a number then the : is optional. Likewise the .png on the end is optional if the name does not contain a ..
  • W - initial browser width in pixels, defaults to 1024
  • H - initial browser height in pixels, defaults to 768
  • Z - initial browser zoom, defaults to 1
  • w - actual output image width, cropping or empty pixels if needed, defaults to the final width of the content multiplied by the resize factor (that is, defaults to the whole image)
  • h - actual output image height, cropping or empty pixels if needed, defaults to the final height of the content multiplied by the resize factor
  • x - image resize factor (as in "0.5x size"), defaults to 1 unless an actual width and height are provided, in which case we use the largest scale that will fill the output image.

Some examples:

# full size screenshot, called full.png
webkit2png full https://www.gov.uk

# crop screenshot to 800x600, do not resize:
webkit2png cropped:800w600h https://www.gov.uk/

# resize to quarter size then crop to 200x150:
webkit2png resized:200w150h0.25x https://www.gov.uk/

# iphone screenshot, at full size, output as iphone.png
webkit2png iphone:640W1136H https://www.gov.uk
# as above, but output as wwwgovuk-640W1136H.png
webkit2png 640W1136H https://www.gov.uk

# 320, 640 and 1024 width, full page height
webkit2png 320W 640W 1024W https://www.gov.uk

# 1000 width and 200x150 thumbnail grabs, output: full.png, thumb.png
webkit2png full:1000W thumb:1000W200w150h https://www.gov.uk

We're not going to land that PR so I'm opening an issue instead. And looking back at that spec now I'm not sure I agree with the details so maybe we can change them.

This was referenced Mar 26, 2020
@paulhammond
Copy link
Owner Author

Ideally this would also support specifying a different output format. #27 and #49 are about PDFs but I could see others in the future.

@paulhammond
Copy link
Owner Author

And it should support outputting to the clipboard (see #70 and #71)

This was referenced Mar 26, 2020
@paulhammond paulhammond added this to the v2.0 milestone Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant