-
Notifications
You must be signed in to change notification settings - Fork 141
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
save an array as png through ImageMagick generate broken image. #909
Comments
I inserted some debugging code in ImageMagick.jl: 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. |
GitHub is blocking me from transfering this to JuliaIO/ImageMagick.jl because it's in a different organization. If someone else can transfer it, let's do so, otherwise let's just close this. |
I posted this issue to ImageMagick.jl, so close this one. |
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.
The text was updated successfully, but these errors were encountered: