Closed babaq closed 3 years ago
Can't reproduce it in docker run -it --rm julia:1.6
:
(@v1.6) pkg> add FileIO, ImageIO, ImageCore
julia> using ImageCore, FileIO
julia> a = rand(2024, 2048);
julia> save("test.tif", Gray.(a))
shell> du test.tif
32388 test.tif
I don't think numerical array is consistently supported. You might have to change it to Gray
colorant.
I test it again, it works on a Ubuntu system, but not on windows 10 version 21H1.
Also tried png, it made Julia crashed. ` Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks. Exception: UNKNOWN at 0x7ffa78fc17c0 -- RtlVirtualUnwind at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line) in expression starting at E:\Code\temp.jl:421 RtlVirtualUnwind at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line) RtlVirtualUnwind at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line) RtlUnwindEx at C:\WINDOWS\SYSTEM32\ntdll.dll (unknown line) setjmpex at C:\WINDOWS\System32\msvcrt.dll (unknown line) png_longjmp at C:\Users\fff00.julia\artifacts\72037f1415327f12277eed0521c861517630a0ba\bin\libpng16.dll (unknown line) MagickPNGErrorHandler at /workspace/srcdir/ImageMagick6-6.9.10-12\coders\png.c:1650 png_error at C:\Users\fff00.julia\artifacts\72037f1415327f12277eed0521c861517630a0ba\bin\libpng16.dll (unknown line) png_put_data at /workspace/srcdir/ImageMagick6-6.9.10-12\coders\png.c:1464 png_write_complete_chunk at C:\Users\fff00.julia\artifacts\72037f1415327f12277eed0521c861517630a0ba\bin\libpng16.dll (unknown line) png_compress_IDAT at C:\Users\fff00.julia\artifacts\72037f1415327f12277eed0521c861517630a0ba\bin\libpng16.dll (unknown line) png_write_find_filter at C:\Users\fff00.julia\artifacts\72037f1415327f12277eed0521c861517630a0ba\bin\libpng16.dll (unknown line) png_write_row at C:\Users\fff00.julia\artifacts\72037f1415327f12277eed0521c861517630a0ba\bin\libpng16.dll (unknown line) WriteOnePNGImage at /workspace/srcdir/ImageMagick6-6.9.10-12\coders\png.c:11438 WritePNGImage at /workspace/srcdir/ImageMagick6-6.9.10-12\coders\png.c:12516 WriteImage at /workspace/srcdir/ImageMagick6-6.9.10-12\magick\constitute.c:1260 WriteImages at /workspace/srcdir/ImageMagick6-6.9.10-12\magick\constitute.c:1409 MagickWriteImages at /workspace/srcdir/ImageMagick6-6.9.10-12\wand\magick-image.c:13280 writeimage at C:\Users\fff00.julia\packages\ImageMagick\b8swT\src\libmagickwand.jl:293 [inlined]
save at C:\Users\fff00.julia\packages\ImageMagick\b8swT\src\ImageMagick.jl:163 [inlined] save at C:\Users\fff00.julia\packages\ImageMagick\b8swT\src\ImageMagick.jl:163
unknown function (ip: 00000000621aa9a9) Allocations: 47711893 (Pool: 47694653; Big: 17240); GC: 57 `
Nothing suspicious from my understanding. It might be due to a broken artifact, can you verify this on a clean depot path? For example, start the Julia with the environment JULIA_DEPOT_PATH
to somewhere temporarily, and repeat https://github.com/JuliaImages/Images.jl/issues/967#issuecomment-888065518
I'm not a Windows guy so don't know much about how to set the environment, in ubuntu, it can be done via e.g., JULIA_DEPOT_PATH=tmp julia
.
I deleted all artifacts, and update the environment, the crash remains.
The message you showed uses ImageMagick
to load the tiff image, that's strange to me. Since Images v0.24, we're using TiffImages via ImageIO with higher priority.
Can you check if explicitly using ImageIO backend works?
using FileIO, ImageIO, ImageCore
ImageIO.save(File{format"TIFF"}("test.tif"), rand(Gray{N0f8}, 2080,2080))
Also, what's your FileIO version?
I am about to show this, i found the TiffImages.jl
, and since it's a pure julia packages, so i tried this:
using TiffImages,ImageCore
a = rand(RGB{N0f8},2080,2080)
img = TiffImages.DenseTaggedImage(a)
TiffImages.save("test.tif",img)
and the result tiff is just 167 bytes and not recognizable.
@tlnagy any ideas on this?
FYI, I'm a Windows 10 user and I can't reproduce the problem using ImageMagick.jl to save either TIFF or PNG.
What are the contents of the broken files?
julia> read("test.tif", 32)
Here is the system info, my windows 10 is version 21H1.
Since you have a lot of packages installed in your environment, it is recommended that you test with a minimal set of packages first.
I was also concerned about the number of threads, but on my machine, it worked even with 8 threads.
I tried removing some packages, then problems solved.
Thanks for your help and tips.
This save a tiff of 42.5KB:
but
a = rand(2080,2080)
saved a tiff of 258 Bytes that system can't recognize.Tested on
Julia v1.6.1
,Images v0.24.1