Yea, that's something I have been trying to build, but it's surprisingly non-trivial. There are a bunch of headless browser options, but I haven't found a good way to tell them: "Render the page in X width and Y height and then take a screenshot".
That seems like a problem that should have 100 open source solutions for it, and I am sure there are some that work really well! But I personally haven't found one yet.