Search code examples
rimagejpegtiff

How to convert tiff image to jpeg using r


I have a hundred image that are in TIFF format, I want to convert them to JPEG format. I use the R language. could you please tell me what function or what package should I use to make this conversion in r. Thank you in advance.


Solution

  • An indirect way to convert tiff to jpeg image is to read TIFF image and then write JPEG using package tiff and jpeg. For example:

    #Load
    library("jpeg")
    library("tiff")
    
    img <- readTIFF("origin.tiff", native=TRUE)
    writeJPEG(img, target = "Converted.jpeg", quality = 1)