Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.11k stars 107 forks source link

Images are not displayed #292

Closed mwisnicki closed 3 years ago

mwisnicki commented 3 years ago
val img = ImageIO.read(java.net.URL("https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/JetBrains_Logo_2016.svg/222px-JetBrains_Logo_2016.svg.png"))
DISPLAY(img)

Results in calling toString rather than displaying image inline.

BufferedImage@5dffdd4b: type = 6 ColorModel: #pixelBits = 32 numComponents = 4 color space = java.awt.color.ICC_ColorSpace@a197725 transparency = 3 has alpha = true isAlphaPre = false ByteInterleavedRaster: width = 222 height = 240 #numDataElements 4 dataOff[0] = 3
mwisnicki commented 3 years ago

Also it's very annoying MIME only takes String rather than Buffer or byte[].

mwisnicki commented 3 years ago

I've found this by searching the code (should be easier to discover such things)

%use lib-ext
Image(img)

But IMHO DISPLAY should work for basic built in types out of the box.