if (interactive() && requireNamespace("EBImage")) {
library(pliman)
# Load a sample raster
mosaic <- mosaic_input(system.file("ex/elev.tif", package = "terra"))
# Interactive cropping with drawn rectangle
cropped <- mosaic_crop(mosaic)
# View result
mosaic_view(cropped)
}
Run the code above in your browser using DataLab