When I post small examples of LaTeX code, I use the
convert -density 600 -trim file.pdf file.png method. This gives files that are extremely lightweight and integrate well into TeX.SE's quote environment to look really nice, like:
These images are very high resolution but extremely lightweight, the above is just 116 kb but 2,869px by 1,866px—large enough to actually show how nice LaTeX looks.
However, we often get questions involving page layouts and margins, where this method doesn't work because we need to indicate where the page itself is. Usually this is done using screenshots, like:
However, these images don't integrate well into the surrounding text and are extremely low resolution, making the text blurry. There's also no way to guarantee the alignment (ok, I exaggerated here, it's not usually this bad), because you just have to guess using the selection.
Is there a better way to do this, preferably automated?
While typing this I found the question "What is the best method to capture latex output for questions and answers?" which has a similar ImageMagic solution to mine (I do recommend the -trim option though) but I don't think it's a duplicate because my question asks how to show the whole page too.