R/RmFlirTag_function.R

Defines functions RmFlirTag

Documented in RmFlirTag

#' ReVuePro: RmFlirTag
#'
#' A short function to remove encryption tags from FLIR(TM) Vue Pro, radiometric JPGs to permit simple, downstream analysis of temperature using open source software. Note that your Date/Time stamp will NOT be saved, so it is recommended that you do not delete the parent rJPG before using the function "DatePreserve" to carry creation dates/times forward.
#' @param ReadFile The path to your Vue Pro radiometric JPG (rJPG) that you wish to rid of encryption. There is no default input.
#' @param Destination The path to a folder at wish you would like to save your decrypted, Vue Pro radiometric JPG (rJPG).
#' @keywords VuePro, Thermal
#' @export
#' @examples
#' setwd("C:/Users/JKR/Desktop/Hummingbirds")
#' RmFlirTag("SleepingHummingbird.jpg", "C:/Users/JKR/Desktop/Decrypted")

RmFlirTag<-function(ReadFile,Destination){
      
      dir1<-getwd()
      dir2<-Destination
      WriteFile=gsub("\\..*", "",ReadFile)

      readingIn <- file(ReadFile, "rb")
      BinData <- readBin(readingIn, raw(), n = file.info(ReadFile)$size)
      toremove<-c(67703:67714,133239:133250)
      Tagless<-BinData[-toremove]

      setwd(dir2)
      con <- file(WriteFile) 
      open(con, "wb")
      writeBin(Tagless, con, raw(),endian = .Platform$endian)
      close(readingIn)
      close(con)
      setwd(dir1)
}
joshuakrobertson/R-Package_ReVuePro documentation built on June 2, 2020, 8:23 p.m.