gtatters / Thermimage

R Package for working with radiometric thermal image files and data
GNU General Public License v3.0
164 stars 41 forks source link

readflirJPG doesn't like file paths with spaces in #1

Closed rasenior closed 5 years ago

rasenior commented 6 years ago

Hullo,

Some of my files have spaces in the path (Google Drive's fault: "C:/Users/Rebecca/Google Drive/files"), which I thought worked in the past but my current version of Thermimage (3.1.0) doesn't seem to like it. For this image, this works fine:

library(Thermimage)
test1 <- readflirJPG("C:/Temp/without_spaces/FLIR8563.jpg")

But adding a space: test2 <- readflirJPG("C:/Temp/with spaces/FLIR8563.jpg")

I get:

File not found: C:/Temp/with
File not found: spaces/FLIR8563.jpg
Error in embed(vect, length(fid)) : wrong embedding dimension
In addition: Warning message:
In shell(paste(syscommand, imagefile, vals)) :
  'exiftool C:/Temp/with spaces/FLIR8563.jpg -b > tempfile' execution failed with error code 1
Timing stopped at: 0.04 0 0.23

My session info is below. Thanks in advance - great package!

Rebecca

R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Thermimage_3.1.0

loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0    yaml_2.1.18    png_0.1-7
gtatters commented 6 years ago

Thanks for letting me know.

see if single quotes fixes the issue:

test1 <- readflirJPG('C:/Temp/with spaces/FLIR8563.jpg')

Alternatively, you can setwd("C:/Temp/with space") internally in R and simply load the file in without path information.

rasenior commented 6 years ago

No worries. Same problem with single quotes, but changing the working directory is fine so I will do that for now. Thanks

gtatters commented 6 years ago

ok. thanks for that. single quotes works on Mac OS to fix that issue.

I don't have a PC to test this on, unfortunately, but even I use setwd() from within R to make these calls explicit.

The readflirJPG call to exiftool is a kludge until I develop a better method

gtatters commented 6 years ago

Maybe try running the following function.

readflirJPGv2.txt

I notice I had a different shell call for Windows OS due to this previously being problematic with other versions of Windows.

Once you this function, try using readflirJPG2 instead of the readflirJPG. I might be able to patch this for Windows users and add some help.

rasenior commented 6 years ago

Thanks I tried the new function, but it went a bit crazy. Got the following result: screenshot

gtatters commented 6 years ago

thanks for trying. I'll try to get a windows machine so I can troubleshoot better.

gtatters commented 5 years ago

finally accessed a windows 7 machine to test out the whitespace error, and found a fix. probably too late for you. I have not tested on different windows versions.

rasenior commented 5 years ago

This works, thank you!