-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Strange rotation & tiling image display #229
Comments
Hah! After having worked on this for quite some time, seconds after hitting "submit" I finally figured out where the problem is coming from: this If I insert CC @dcjones. |
Also I should add that for an image, Color's "svg swatches" output causes a massive performance problem. (See JuliaImages/Images.jl#181 (comment).) Clearly we need the variant in Images to be preferred. |
@timholy, the way the Jupyter protocol works is that kernels can send multiple representations of data to display, in the form of a dictionary from mime types to the corresponding data. This way, the front-end can decide what version to display (and a future version of the notebook front-end may allow you to switch between representations, e.g. by right-clicking). The IJulia kernel therefore sends several representations of the output, depending on what mime types are As you note, one difficulty with SVG is that, for large/complex images, it can be much slower than PNG. In consequence, PyPlot defaults to not sending SVG, for example. |
One option would be to define |
(Another option would be to remove the |
Thanks for the explanation. Of the various options on the table, disabling via |
There must be something about the display framework that I'm missing, because with the new version of Images I'm stumped by a strange IJulia bug. Here's the summary:
writemime
forimage/png
produces a binary blob that, when written to a file, seems fine when viewed with an image file viewer (gwenview
) or via IJulia with a "bare" wrapperwritemime
for an Image type causes a strange rotation and tiling of pixels.Steps to test:
Pkg.test("Images")
. The purpose of this step is simply to download a small test image, deposited in/tmp/Images/rose.png
. If you've done this once, you don't have to do it again.saved to a file
bareimage.jl
.writemime
: right before this line, add the following:/tmp/Images
folder. Run the commands in this screenshot:This already illustrates the surprising result. First, from the
typeof(blob) = Array{Uint8,1}
and the creation of the/tmp/rosei.png
file, it's clear the correct version ofwritemime
is being called. The resulting image is rotated clockwise 90 degrees, and the individual pixels are "tiled" into a larger object and have a gap of white space between them. But only when viewed as the direct output ofImages.writemime
; viewing the same file as aBareImage
produces the expected results.Images
folder do agit checkout v0.3.3
. Make the same changes tosrc/io.jl
that you did above, although here I named itrosei_old.png
. Restart the IJulia kernel and load the same commands. Here's what I get:Viewing both
rosei.png
androsei_old.png
withgwenview
produces the same image. ImageMagick'scompare
tool reveals no differences, andidentify -verbose
does not reveal any differences other than the datestamp.I confess to find this quite mysterious. FYI I'm running a recent master of 0.4. However, this same bug has been reported by another user JuliaImages/Images.jl#181 (comment); I've reproduced his result on two machines, one running firefox & julia 0.3. (There you can't see the tiles because for a larger image they get squished together, but it seems to be the same bug.)
The text was updated successfully, but these errors were encountered: