Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.6%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 1
  • Releases: 0
Created almost 3 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# screenshot




The goal of screenshot is to take a screenshot easily and locate image position on a display with R.


## Installation

You can install the development version from [GitHub](https://github.com/) with:

```{r, eval = FALSE}
  # install.packages("remotes")
remotes::install_github("matutosi/screenshot")
install.packages("screenshot")  # You can also install from CRAN:
```

On Windows, need to install screenshot.exe by `install_screenshot()`.
This exe file is compiled from codes shown below.

https://superuser.com/questions/75614/take-a-screen-shot-from-command-line-in-windows#answer-1751844

```{r, eval = FALSE}
library(screenshot)
  # required on win
install_screenshot()
  # if you want to install another directory
  # bin_dir <- "SET_YOUR DIRECTORY"
  # install_screenshot(bin_dir)
```

On Mac `screencapture` is usually available. 

On Linux GNOME desktop use `gnome-screenshot`. 
If not installed, run `sudo apt install gnome-screenshot`.


## Example

You can use `screenshot()` to take a screenshot easily.

```{r eval = FALSE}
library(screenshot)
sc <- screenshot()
sc_image <- imager::load.image(sc)
plot(sc_image)
```

To locate image from a screenshot, use `locate_image()`. 
In this case, bottom left corner of screenshot image was cut off as needle image. 

```{r eval = FALSE}
sc <- screenshot()
sc_image <- imager::load.image(sc)
w <- 100
h <- 80
pos_x <- 1
pos_y <- imager::height(sc_image) - h
needle <- hay2needle(sc_image, pos_x, pos_y, w, h)
(locate_image(needle)) # center location
pos <- locate_image(needle, center = FALSE)
found <- hay2needle(sc_image, pos[1], pos[2], w, h)
layout(c(1:3))
plot(sc_image)
plot(needle)
plot(found)
```


On Windows, clipboard image can be saved by `save_clipboard_image()`.

```{r eval = FALSE}
path_img <- "path_of_png_file"
save_clipboard_image(path_img)
shell.exec(path_img)
```

## Caution (=0.9.0)

- Automatically adjusted in 0.9.1 and latter.   

When changing display DPI scaling, need to adjust position. 
```{r eval = FALSE}
  # when using 125%
pos <- locate_image(IMAGE_TO_CLICK) / 1.25
KeyboardSimulator::mouse.move(pos[1], pos[2])
KeyboardSimulator::mouse.click()
```

You can see display scale in setting app as shown below. 




## Citation

Toshikazu Matsumura (2023) screenshot. Screenshot and locate image Easily. https://github.com/matutosi/screenshot/.

Owner

  • Name: Toshikazu Matsumura
  • Login: matutosi
  • Kind: user

GitHub Events

Total
  • Watch event: 3
  • Push event: 13
Last Year
  • Watch event: 3
  • Push event: 13

Packages

  • Total packages: 1
  • Total downloads:
    • cran 548 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: screenshot

Take Screenshots (Screen Capture) from R Command

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 548 Last month
Rankings
Forks count: 28.3%
Dependent packages count: 28.4%
Stargazers count: 31.3%
Dependent repos count: 36.9%
Average: 38.5%
Downloads: 67.7%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran