I want to read some .png files all one by one, and want to concatenate the text generated from all the files. I am using the below code:
filenames <- list.files(path = "C:/Users/tmpxk9/Documents", pattern="*.png")
for (i in seq_along(filenames)) {
xx <- magick::image_read("filenames[i]")
xx %>%
magick::image_resize("2000x") %>%
magick::image_convert(type = 'Grayscale') %>%
tesseract::ocr() %>%
cat()
}
It errors out with the following error:
Error in magick_image_readpath(enc2native(path), density, depth, strip) :
rsession.exe: UnableToOpenBlob `C:\Users\tmpxk9\Documents\filenames[i]': No such file or directory @ error/blob.c/OpenBlob/2701