-
Notifications
You must be signed in to change notification settings - Fork 1
/
make_one_tile.R
24 lines (21 loc) · 901 Bytes
/
make_one_tile.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#' Tile an image
#'
#' Tile images in a directory
#'
#' @param img Path to an image folder
#' @param crop_path Path to an folder to be made that will have the images out
#' @param width width in pixels of the crop
#' @param height height in pixels of the crop
#' @param buff buffer to overlap crop by x pixels
#' @param corner_x x coord of the top left corner of the crop
#' @param corner_y y coord of the top left corner of the crop
#' @return not much really. just a list of names of images in
#' @export
#' @importFrom magick image_crop image_write
#' @author Abram Fleishman \email{abram@@conservationmetics.com}
make_one_tile<-function(img,crop_path,width,buff,height,corner_x,corner_y){
#crop string (WxH+offset_x+offset_y)
crop<-paste0(width+(buff),"x",height+(buff),"+",corner_x,"+",corner_y)
img2<-image_crop(img,geometry =crop,repage = T )
image_write(img2,path = crop_path)
}