How to generate a URL from a screenshot
TL;DR: Easily host your screenshots using githubâs magic links.
Every once in a while, I find myself needing an image, particularly a screenshot, in the form of a URL. This is usually because I am updating a README, adding an image to a jupyter notebook, adding something to a forum, etc. but donât want to bother hosting the image myself.
Who wants to pollute a git repo with assets/images/
for a single image? The issue is, if you donât own the image link, it might break someday and someone somewhere wonât be happy.
My best solution? Use github. SURE, it wasnât meant to do this - but hereâs a pro tip - if you are opening an issue, updating a README, etc. you can simply âpasteâ your screenshot in the dialogue box and a custom github URL will automagically be created to host your image.
So letâs see how it works:
1. Take your screenshot
2. On github: open an Issue, edit a README, etc.
3. hit Ctrl-P inside the text editor - and voilĂ
You should then see a githubusercontent
magic link generated. Use it anywhere!
The best part is that itâs already formatted in markdown for you. In fact, this screenshot was taken exactly like that. Donât believe me? Just look at the link to the image.
I know what youâre thinking - it might die some day - and sure thatâs a valid point - but github is a huge org and hosts some of the most important tech projects in the world. It canât afford to just make the images from a README disappear.
If you are ever reading this and the photo is no longer available - well, I guess by then weâll know how long these links actually last :)
Comments