Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading image fails on windows #183

Open
jonathanBieler opened this issue Jul 18, 2020 · 11 comments
Open

Loading image fails on windows #183

jonathanBieler opened this issue Jul 18, 2020 · 11 comments

Comments

@jonathanBieler
Copy link

Installing the package and using work but when I try to load an image (FileIO.load) I get :

Fatal error:
ERROR: UnableToOpenBlob `C:/Users/User/AppData/Local/Temp/magick-8592hIzemuw0tD2h.ppm': No such file or directory @ error/blob.c/OpenBlob/2873
Stacktrace:
 [1] handle_error(::ErrorException, ::File{DataFormat{:TIFF}}) at C:\Users\Billou.asd-PC\.julia\packages\FileIO\zL0JE\src\error_handling.jl:82
 [2] handle_exceptions(::Array{Any,1}, ::String) at C:\Users\Billou.asd-PC\.julia\packages\FileIO\zL0JE\src\error_handling.jl:77
 [3] #load#27(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(load), ::Formatted) at C:\Users\Billou.asd-PC\.julia\packages\FileIO\zL0JE\src\loadsave.jl:189
 [4] load at C:\Users\Billou.asd-PC\.julia\packages\FileIO\zL0JE\src\loadsave.jl:166 [inlined]
 [5] #load#13 at C:\Users\Billou.asd-PC\.julia\packages\FileIO\zL0JE\src\loadsave.jl:118 [inlined]
 [6] load(::String) at C:\Users\Billou.asd-PC\.julia\packages\FileIO\zL0JE\src\loadsave.jl:118
 [7] top-level scope at REPL[47]:1

Why is it looking for files in my temp folder, that seems a bit fishy ?

Julia 1.3, ImageMagick v1.1.5, I had previous versions that worked in the past.

@johnnychen94
Copy link
Member

Would you mind providing more details about this? How do you load that image, and is it a particular image or image format that causes this issue?

It might be unrelated to this, but there's a new FileIO release v1.4.0 recently, probably you could take a try with an older version of FileIO?

@jonathanBieler
Copy link
Author

jonathanBieler commented Jul 18, 2020

Sure, I'm trying to load CR2 files (raw pictures), using FileIO.load(files[1]). It actually works if I first convert the image to tif (I assume imagemagick is used for tif ?) so it's maybe specific to that file format.

@mfalt
Copy link

mfalt commented Jul 29, 2020

I get a very similar error trying to load raw DNG files on windows:

using Images
img = load("myfile.dng")

Error encountered while loading "C:\\Users\\Mattias\\Documents\\imgtest\\myfile.dng".

Fatal error:
ERROR: UnableToOpenBlob `C:/Users/Mattias/AppData/Local/Temp/magick-12116GB_CM677xccI.ppm': No such file or directory @ error/blob.c/OpenBlob/2873
Stacktrace:
 [1] handle_error(::ErrorException, ::FileIO.File{FileIO.DataFormat{:TIFF}}) at C:\Users\Mattias\.julia\packages\FileIO\zL0JE\src\error_handling.jl:82
 [2] handle_exceptions(::Array{Any,1}, ::String) at C:\Users\Mattias\.julia\packages\FileIO\zL0JE\src\error_handling.jl:77
 [3] load(::FileIO.Formatted; options::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\Mattias\.julia\packages\FileIO\zL0JE\src\loadsave.jl:189
 [4] load at C:\Users\Mattias\.julia\packages\FileIO\zL0JE\src\loadsave.jl:166 [inlined]
 [5] #load#13 at C:\Users\Mattias\.julia\packages\FileIO\zL0JE\src\loadsave.jl:118 [inlined]
 [6] load(::String) at C:\Users\Mattias\.julia\packages\FileIO\zL0JE\src\loadsave.jl:118
 [7] top-level scope at REPL[17]:1

Edit: It doesn't help to downgrade FileIO.jl or ImageMagick.jl

@ordicker
Copy link

Got the same error on Linux too

@timholy
Copy link
Member

timholy commented Aug 6, 2020

This may be an ImageMagick bug rather than a Julia bug, but until someone either dives in to the Julia code and tells us what they've found, or posts an image that others can use to reproduce the bug, there's precious little chance of doing anything about this.

@ordicker
Copy link

ordicker commented Aug 6, 2020

I downloaded DNG file from google's hdrplusdata.
Any way for convenient I uploaded one image here, hope that isn't license violation.

@jonathanBieler
Copy link
Author

If I understand the code here correctly it's just doing a ccall into ImageMagick library :

https://github.com/JuliaIO/ImageMagick.jl/blob/master/src/libmagickwand.jl#L272

And it looks like people get this kind of issues with the standalone tool :

https://www.imagemagick.org/discourse-server/viewtopic.php?t=12881
https://www.imagemagick.org/discourse-server/viewtopic.php?t=32222

@mfalt
Copy link

mfalt commented Aug 6, 2020

TL DR: Missing ufraw-batch on the system results in this error.

Ok, so after some digging, I can verify that the problem occus using the c interface to the downloaded files (ImageMagick 6.9.10-12). And it is easy to reproduce using the binaries.

However, the problem occurs because of the missing dependency ufraw-batch. You can see this by running

~/.julia/packages/ImageMagick/vMfoS/deps/usr/bin/identify -list delegate
which states
dng:decode => "ufraw-batch' --silent --create-id=also --out-type=png --out-depth=16 '--output=%u.png' '%i"

or by printing the complete error message when trying to convert the image

~/.julia/packages/ImageMagick/vMfoS/deps/usr/bin/convert ~/imgtest/test.dng ~/imgtest/test.png
convert: DelegateFailed `'ufraw-batch' --silent --create-id=also --out-type=png --out-depth=16 '--output=%u.png' '%i'' @ error/delegate.c/InvokeDelegate/1919.
convert: UnableToOpenBlob `/tmp/magick-8759PY04LKTGS9ek.ppm': No such file or directory @ error/blob.c/OpenBlob/2873.
convert: NoImagesDefined `/home/mattias/imgtest/Bias.png' @ error/convert.c/ConvertImageCommand/3258.

On linux I was able to solve it by installing ufraw-batch, after which ImageMagick.load("test.dng") works fine.
I notice that ufraw-batch does not seem to be one of the binary dependencies listed for ImageMagick.jl, however it is mentioned on https://imagemagick.org/script/resources.php
It seems like the configuration for ImageMagick could be changed to libraw instead, see ImageMagick/ImageMagick#1617

I don't completely understand the delagation in ImageMagick, so I dont know if this is the right approach.

@timholy
Copy link
Member

timholy commented Aug 6, 2020

I've cross-posted to JuliaPackaging/Yggdrasil#1421, where the build-script for ImageMagick appears to be stored: https://github.com/JuliaPackaging/Yggdrasil/blob/master/I/ImageMagick/build_tarballs.jl

@giordano
Copy link
Member

It isn't clear to me what's the problem exactly. My understanding is that ufraw-batch isn't a dependency of ImageMagick, does it need to be only present at runtime? Also, what software is ufraw-batch exactly? On the Internet I found different stuff.

@NaNotia
Copy link

NaNotia commented Dec 11, 2020

I've got the same issue, it isn't fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants