imager icon indicating copy to clipboard operation
imager copied to clipboard

Images read differently on ubuntu vs windows

Open MahShaaban opened this issue 7 years ago • 1 comments

I noticed that sometimes the numeric values of the images loaded by load.imgae() are different when using ubuntu and windows. I traced this issue back to jpeg::readJPEG, at least in part.

On ubuntu

> version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          5.1                         
year           2018                        
month          07                          
day            02                          
svn rev        74947                       
language       R                           
version.string R version 3.5.1 (2018-07-02)
nickname       Feather Spray
> packageVersion('jpeg')
[1] ‘0.1.8’               
> fl <- system.file('img', 'Rlogo.jpg', package = 'jpeg')
> img <- jpeg::readJPEG(fl)
> mean(img)
[1] 0.7046421

On windows

> version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.1                         
year           2018                        
month          07                          
day            02                          
svn rev        74947                       
language       R                           
version.string R version 3.5.1 (2018-07-02)
nickname       Feather Spray
> packageVersion('jpeg')
[1] ‘0.1.8’               
> fl <- system.file('img', 'Rlogo.jpg', package = 'jpeg')
> img <- jpeg::readJPEG(fl)
> mean(img)
[1] 0.7047047

Notice the difference starting at the 4th decimal point. I am showing the mean here, but I visually inspected the values themselves and they look different.

I encountered this while working on a package called colocr which relies on some of the imager functionality. I could only replace imager::load.image() with magick::image_read() to pass the tests on windows/appveyor MahShaaban/colocr#3.

I think this might be related to #41 as well.

Thanks

MahShaaban avatar Oct 02 '18 01:10 MahShaaban

:point_up: @maelle. Thanks.

MahShaaban avatar Oct 02 '18 01:10 MahShaaban