Use IrfanView to Crop the Image and Set Borders

cropImageAndSetBorders(
  inputdir,
  outputdir,
  irfanViewExe = defaultIrfanViewExe(),
  crop = c(left = 0, top = 0, width = -1, height = -1),
  border = c(left = 0, right = 0, top = 0, bottom = 0),
  canvasColor = 255,
  useIni = TRUE,
  wait = FALSE,
  inputPattern = "*.gif"
)

Arguments

inputdir

full input path including file name or pattern, e.g. "*.png", "*.gif"

outputdir

full output path including file name or pattern, e.g. "*.pgm"

irfanViewExe

path to IrfanView Executable File

crop

vector of four integers (left, top, width, height): optional coordinates for cropping. If crop["left"] != -1 the image will be cropped, otherwise not.

border

vector of four integers (left, right, top, bottom)

canvasColor

passed to kwb.iview:::writeIniFile

useIni

logical. If TRUE (default) an INI file is written and IrfanView is called with the /ini option on the command line

wait

passed to shell.

inputPattern

file name pattern matching the files in inputdir to be processed