Crop a section out of a native raster image into a new image

nr_crop(nr, x, y, w, h)

nr_crop2(nr, loc)

Arguments

nr

native raster image

x, y, w, h

dimensions of cropped section

loc

dimensions of cropped section. A vector of 4 values i.e. c(x, y, w, h)

Value

New native raster image

Examples

nr <- deer[[1]]
dim(nr)
#> [1] 32 32
plot(nr)


nr2 <- nr_crop(nr, 16, 0, 16, 16)
dim(nr2)
#> [1] 16 16
plot(nr2)