Should the repl show images?

When I create an image in the repl I get a huge RGB array, but in Jupyterlab I do get the image. I thought the repl also showed images. That is:

using Images, TestImages
img = testimage(“mandrill”)

shows a mandrill in Jupyterlab, but just a huge array in the repl. I prefer to use the repl to learn, since Jupyterlab is cumbersome. Is there a way to have the repl show images?

1 Like

Is the REPL in VSCode (with Julia extensions) showing images?

As a (at least in my opinion) better alternative to Jupyter there is https://github.com/fonsp/Pluto.jl

1 Like

Most terminal emulators usually don’t support displaying images inline like that, though there’s a few that do these days (https://github.com/kovidgoyal/kitty comes to mind as one option), there’s even a Julia package that appears to be able to be used with it: https://github.com/simonschoelly/KittyTerminalImages.jl though I’ve not used it myself.

2 Likes

This is what UnicodePlots does (quick & dirty example):

using UnicodePlots, Images
img = Gray.(rand(600,600))
imgc = gray.(img)
UnicodePlots.heatmap(imgc)

And there is the cool package by @ianshmean, VideoInTerminal.jl that outputs the video camera image stream to the REPL!

2 Likes

ImageInTerminal.jl:

Unfortunately it’s font-dependent - for the most accurate reproduction, you’ll have to step through all your fonts to find the one that’s just right.

4 Likes

These image or video in terminal packages are kind of cool, but also so gimmicky. For people not already embedded in terminal centric workflows this could appear like a joke, why would anybody be satisfied with such a pixelated display. Being used to the constrained feature set of terminals, one might think what a cool workaround, I’ll take it!

2 Likes

If you’re on a Mac using iTerm2, check out TerminalExtensions.jl for high res images in the terminal.

Kitty is a fantastic and robust terminal. I use it to show high quality images in the repl since quite a while.

Yep. What’s so bad in doing an extra imshow(img) and see a high-res image?

@joa-quim, if running Julia on Android cell phone, for one.

If you work a lot with images you can place this in your startup.jl file:

using Images, ImageView, ImageIO

function Base.display(img::Array{RGB{Normed{UInt8, 8}}, 2})
    display(imshow(img))
end

Next time you work with images in your REPL instead the array you see now a new window will open with the image and the text output will look something like:

julia> img
Dict{String, Any} with 4 entries:
  "gui"         => Dict{String, Any}("window"=>GtkWindowLea ...
  "roi"         => Dict{String, Any}("redraw"=>100: "map(clim- ...
  "annotations" => 53: "input-14" = Dict{UInt64, Any}() Dict{ ...
  "clim"        => 52: "CLim" = CLim{RGB{Float64}}(RGB{Float64}( ... 

Thanks. I’ll have to try that package. There are soooo many options for imaging packages, some of which haven’t worked out, are too complex at my level, or aren’t even there, that I’m lost in the woods. The package system needs some cleaning out :smiley:

Wish I could try it, but I’m on Windows. I could install Linux but I just don’t have time to re-learn it when I’m full bore on Julia and Math :smiley: Maybe they’ll come out with a winversion soon.

I find I’m learning faster by fiddling with the terminal, than loading Jupyter, which has a high overhead, and is slower. So I was hoping to see images in the terminal. You can get a pic to load outside the terminal with some packages, but again, I’d rather just load them in the terminal. Julia is a great language to learn but the packages are confusing. There are at least 20 just for imaging.

Julia has a tendency to avoid monolithic do-it-all packages, towards smaller ones that are composed with each other. Often, if there are 20 packages, they are supposed to work together. Not sure about the image ecosystem in particular though to be honest.

If they would just load automatically as dependencies that would be fine, but you appear to have to find the dependencies on the fly.

ImageView and ImageIO failed to add, but Images works fine so I’ll keep it simple.