The Smart Chef

Convert HEIC file to jpeg

An HEIC file is a type of image file format that is commonly used on Apple devices such as the iPhone, iPad, and Mac. HEIC stands for High Efficiency Image Container and is a new image format that was introduced with iOS 11 in 2017. The HEIC format is designed to be more efficient than other image formats such as JPEG, as it allows for higher quality images to be stored in smaller file sizes. This makes it ideal for use on mobile devices where storage space is limited and fast data transfer speeds are important.

The HEIC format supports features such as depth maps, alpha channels, and live photos, making it a versatile and flexible format for capturing and storing digital images. However, it may not be supported by all devices and applications, so it's important to keep this in mind if you are sharing HEIC files with others. In these cases, you may need to convert the HEIC file to a more widely supported format such as JPEG.

If someone shares a HEIC file with you, you can use the code below to convert the file to a jpg standard.

Convert HEIC to Jpeg

  

# Load the magick library
library(magick)

## This is assuming you have multiple files you are going to loop through.  You can skip down to the file_read line if you want to process a single file.
## If you are utilizing a loop, you will also need to set your "path".
for (file in heic_files){

    full_file <- paste0(path, "Attachments\\", file)

    ## Read heic file
    file_read <- image_read(full_file)

    ## write .jpg file
    outFile <- paste0(path, "\\output\\uploads\\attachments\\", file, ".heic.jpg")
    image_write(file_read, path = outFile, format = "jpg")


  }

}