-
Notifications
You must be signed in to change notification settings - Fork 195
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 widths #66
Multiple widths #66
Conversation
As discussed in paulhammond#63, webkit2png might be better capturing just one URL at a time.
As part of making -W600 actually be a 600px wide grab, remove the (to me) unnecessary complexity of producing smaller images. Other tools are available that already can do this. Also makes width/height integers, because web browsers tend to be sized in integers.
Oh, this contains the controversial moves of removing:
so I'll understand if you don't merge this. :) |
I love the idea here, and I want to get this merged. But there are a few caveats. As I mentioned in #63 I'm in favor of removing the ability to capture multiple URLs. But I'm not in favor of removing the ability to resize and clip the image before saving it - I know you can use So the question is how do we allow one instance of webkit2png to create multiple screenshots of the same page, some with the browser at different sizes, some resized, and some cropped? This is definitely related to #12 and #32. For each output we want to be able to specify starting browser width ( I think the answer here is something like X11's geometry setting. But that only does position and size, so it's not quite what we want. srcset is also close, but doesn't have quite the right options and doesn't work as a command line interface. So, as a strawman, how about we add a new option called Here's some examples:
We could then add I've been pondering this idea for a long time, but never really tried to write it down before so I'm not sure I've got it exactly right. |
One more idea (thanks to @shanewholloway in #52): if the scale isn't specified we could calculate it based on the ratio between the starting browser size and the requested output size. This seems so obvious in retrospect. |
I like this proposal. Admittedly I based my pull request entirely upon my own use case, not the more general one. I was hoping it might spur some action :) I had two main problems — that I need to grab the same page at different widths (and reloading it each time seems wasteful) and that pages that aren't properly responsive/fluid/buzzword mean that specifying -W320 doesn't give me a 320px wide capture. I think the logic for creating clipped images makes this fuzzier than it needs to be. So yes, if we can break that out by separating the idea of "get this url in this size browser" from "now save it at 25% size, at exactly X by Y pixels" it works better in my head. It also means you can get the same page at multiple widths (eg 320, 640, 768, 1024) and still only need to produce one clip/thumbnail not four, three of which are essentially useless. I think you're right that output options are good as {size of browser} plus {output modifiers}, but I would drop the -O and just have arguments be size of browser
output modifiers
(some confusion perhaps because I don't use clips/thumbs so I'm not entirely clear on what the difference is – clip is a portion, thumb is just smaller?) Now, because my use case is grabbing full pages no matter how tall, I see max width/height as output modifiers, but it could be argued that they're browser size modifiers. In terms of what that might look like, there's enough complexity that I don't think you'll find a method that doesn't descend into ugliness. But to address that I do really really like the idea of shorthands wrapping up common options, much like HandBrake's presets. I favour more {number}{descriptor} (eg
|
I can't work out how to structure a reply. So instead here's some bullet points:
Here's another attempt at a spec:
Some examples:
Thoughts? |
Fair point about the wider content; so yes, I mean clipping when referring to narrow browsers; like "if I sized my user agent to 320px and I hadn't scrolled then capture what is visible". Which just gives initial size (minimum) and output clip (maximum) as you've shown. Being able to use whitespace within options would definitely mean having to use a quoting mechanism rather than magic to divine when one set of options had finished and the next started. I did illustrate that in the last of my examples. So in summary, like it. Also really like |
Sounds like we have a plan. Now one of us just needs to find the time to implement it... |
Specify scale and clip width to force window to a particular width. See paulhammond/webkit2png#12 and paulhammond/webkit2png#66 for details of the underlying webkit2png issue.
Any idea when this will be implemented? |
I also need this width setting feature, I was wondering if you had added it to your fork? i can't seem to see any commits mentioning width https://github.com/norm/webkit2png/commits/master |
We need webkit2png to grab at multiple widths for testing responsive designs.
Rather than loading the same URL over and over, webkit2png should resize its internal WebKit instance and save multiple images.