Open kahlsr opened 4 years ago
If you want to read pdf files you have to install ghostscript, or alternatively, use image_read_pdf()
which is based on the R package pdftools.
Hello, thanks for the advice. However, this error appears even when just trying to read .jpeg files.
I doubt that. Does your file have a proper file extension? Can you just pass a jpg path to image_read()
directly, instead of file.choose()
Can you please try to make a complete reproducible example including an example image for me to test the problem?
Hi, I also experienced the same error. It worked when I tried using image_read_pdf() and image_read_svg() for pdf and svg files, but when reading postscript files, the same error appears. Are postscript files readable in magick package?
Reading postscript files requires ghostscript installed on your system.
I already installed ghostscript version 9.53.3, but same error still appears.
Are you using the latest version of magick? Can you show your sessionInfo()
please?
Yes, I'm using magick version 2.5.2
sessionInfo() R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale: [1] LC_COLLATE=English_Philippines.1252 LC_CTYPE=English_Philippines.1252 LC_MONETARY=English_Philippines.1252 [4] LC_NUMERIC=C LC_TIME=English_Philippines.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] magick_2.5.2
loaded via a namespace (and not attached): [1] compiler_4.0.3 magrittr_1.5 tools_4.0.3 curl_4.3 Rcpp_1.0.5 tinytex_0.27 xfun_0.19
And do you have ghostscript installed? What do you see for:
Sys.which("gs")
system("gs --version")
I already installed ghostscript on the system and here's the output for the code:
Sys.which("gs") gs "" system("gs --version") [1] 127
Hello, any idea how to work around this issue? I'm trying out magick package with tesseract in R but I can't seem to make it work due to this error.
Code: `library(magick) img <- image_read(file.choose())
Output image
img
OCR
ocr_text <- image_ocr(img, language = "eng") cat(ocr_text)`