This is an "extension" of VSCode that allows you to screenshot crop anything into markdown document image with simple shortcut keys.
- Press the hotkey
- Screenshot overlay prompts you to crop an area of the screen
- On mouse release, an autofocus textbox pops up so you can enter img name
- Image is saved locally, and a line will be added to your document referencing that image.
Python packages including PIL, tkinter, numpy. An anaconda full installation should suffice.
Firstly, clone this repo (goes without saying).
Secondly, open VSCode, go to tasks.json
, and add the following to the task list, replacing <path-to-crop.py>
with full path to crop.py
in this repo:
{
"label": "crop",
"type": "process",
"command": "${config:python.pythonPath}",
"args": ["<path-to-crop.py>", "${file}"]
}
Thirdly and lastly, go to keybindings.json
, and add the following, replacing ctrl+alt+p
your preferred hotkey:
{
"key": "ctrl+alt+p",
"command": "workbench.action.tasks.runTask",
"args": "crop"
}
Enjoy!
Since I have zero experience with GUI or tkinter. The script relies heavily on external snippets. The reference to the links are commented in code.