You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I saved an image which has values of multiples of 1/3, the saved image shrank along horizontal axis by factor of 1/4 and rest of the image was filled with random vertical pattern.
An expected image from above snippet is a lattice pattern with vertical and horizontal lines.
But actual was those. These outputs were obtained by repeating save(...) function in the snippet. While the same img was passed to save, different vertical pattern appears in right 3/4 in images every time.
A curious point is that when some different value was assigned to the array, the save function works as expected.
Here, 1/5 was assigned instead of 1/3.
This time, shrinking ratio seems to be about 1/2, though
save with ImageIO worked as expected
The above examples were generated without ImageIO package. When you see FileIO package and search png format, it tries to use ImageIO if installed. So I added ImageIO and then re-run the above snipped. That condition created an expected lattice pattern image. So the main cause might be ImageMagick module.
diff --git a/src/libmagickwand.jl b/src/libmagickwand.jl
index 51766d7..07c0ad8 100644
--- a/src/libmagickwand.jl+++ b/src/libmagickwand.jl@@ -237,7 +237,9 @@ end
# nothing
# end
+const lastbuffer = Ref{Any}(nothing)
function constituteimage(buffer::AbstractArray{T}, wand::MagickWand, colorspace::String, channelorder::String; x = 0, y = 0) where T<:Union{Unsigned,Bool}
+ lastbuffer[] = copy(buffer)
cols, rows, nimages = getsize(buffer, channelorder)
ncolors = colorsize(buffer, channelorder)
p = pointer(buffer)
and then did this:
buf = ImageMagick.lastbuffer[]
using ImageView
imshow(buf)
and got this:
So, the image is fine up to the point where Julia hands the data off to the imagemagick C library. Consequently, fixing this bug requires that it be reported to the ImageMagick developers.
This issue was originally reported to Images.jl: JuliaImages/Images.jl#909
When I saved an image which has values of multiples of 1/3, the saved image shrank along horizontal axis by factor of 1/4 and rest of the image was filled with random vertical pattern.
Examples of generating broken images
What I tried was as follow.
An expected image from above snippet is a lattice pattern with vertical and horizontal lines.
But actual was those. These outputs were obtained by repeating
save(...)
function in the snippet. While the sameimg
was passed tosave
, different vertical pattern appears in right 3/4 in images every time.A curious point is that when some different value was assigned to the array, the
save
function works as expected.Another examples
Here, 1/5 was assigned instead of 1/3.
This time, shrinking ratio seems to be about 1/2, though
save with ImageIO worked as expected
The above examples were generated without ImageIO package. When you see FileIO package and search png format, it tries to use ImageIO if installed. So I added ImageIO and then re-run the above snipped. That condition created an expected lattice pattern image. So the main cause might be ImageMagick module.
https://github.com/JuliaIO/FileIO.jl/blob/c55ffe1439dbef1f9a2b44852dda52e89beb530a/src/registry.jl#L90-L98
Other info.
Following is my environment.
Brief debug info
Following is @timholy's reply to original post.
I inserted some debugging code in ImageMagick.jl:
and then did this:
and got this:
So, the image is fine up to the point where Julia hands the data off to the imagemagick C library. Consequently, fixing this bug requires that it be reported to the ImageMagick developers.
Originally posted by @timholy in JuliaImages/Images.jl#909 (comment)
The text was updated successfully, but these errors were encountered: