1
votes

My question is very similar to this, but I have thousands of images on disk and I want to fast read their width and height in pixels without loading each file in memory.

On my Linux machine, I could do something like this for each file:

path_to_file <- 'img/13600061.jpg'
system(sprintf("file %s", path_to_file), intern = TRUE)

But the output of file can differ for jpg, jpeg and png files and then I need to catch the pixel info differently depending on the file. I was wondering if there is a general fast solution out there already.