dahtah / imager

R package for image processing
GNU Lesser General Public License v3.0
187 stars 43 forks source link

Better handling of corrupt files? #49

Closed RemkoDuursma closed 7 years ago

RemkoDuursma commented 7 years ago

Dear Simon,

great work on imager. I use it to process many files, some of which may be corrupted (somehow). I was wondering whether load.image could be slightly more immune to those files.

Attachment: corrupted_file

On load.image("corrupted_file.jpg") I get

'gm.exe' is not recognized as an internal or external command,
operable program or batch file.
'gm.exe' is not recognized as an internal or external command,
operable program or batch file.
Error in load_image(file) : 
  cimg::stderr(): Reference to 'stderr' stream not allowed in R mode ('cimg_use_r' is defined).

I am using try() on load.image so it is not a major issue, but perhaps can be cleaned up (also, the first two messages cannot be suppressed).

(Windows 7, R 3.4.0, imager 0.40.2)

dahtah commented 7 years ago

Hi, thanks for reporting this, you're right, these errors should be handled in a more graceful manner. Will try to fix that soon.

dahtah commented 7 years ago

Your particular issue should now be fixed in the current master branch (I still need to work on errors generated by calls to imagemagick).

RemkoDuursma commented 7 years ago

Unfortunately compilation fails on my system, but I might have to do some local configuring?

../inst/include/CImg.h:451:20: fatal error: tiffio.h: No such file or directory
dahtah commented 7 years ago

Compiling on Windows is a pain, you need to set up your system just like the CRAN one or it doesn't work. Better to just use winbuilder: here's a binary.

RemkoDuursma commented 7 years ago

Right, winbuilder is an easy solution. Tested and works great, thanks.