Save the current image in clipboard to png in your active directory
Source:R/screenshot.R
screenshot.Rd
The screenshot will be saved as .png
to a directory following these rules
In a regular RStudio project (or a Quarto book), it will be saved to a
images/
directoryIn a package project, it will be saved in a
man/figures
directoryIn a Quarto Blog project, it will save in the current post's folder.
You can always override these defaults by setting
dir
After using the shortcut Win + Shift + S, you can call this function!
Details
If no file name is supplied, a file named image0*.png
will be created.
The function then prompts you to rename the file with a more expressive name.
It will continue the numbering if a file named image exists.
Still have to validate if it works on macOS, as it is not clear whether the image goes to the clipboard by default
The maximum number of images in a folder is 99. (only padding 2), should be enough.
You should not be able to overwrite a screenshot with a generic name, only a named one as it is possible you may require to retake your screenshot.