but the images seem to refuse to grow bigger beyond a particular point. I have Images.jl loaded which loads ImageShow, but I want to fill up the screen! How do I change the image display size?
Further increasing the size of the figure does nothing increases the size until a certain threshold is reached at which point the image size is reduced again.
Thanks for the help!
Cannot reproduce using empty Figures from Makie.jl in a notebook I had running.
I put your html snippet in and made several empty figures with different sizes and they just grow until they fill out the space. So I am not sure what causes this shrinking for you. Did you try to inspect the CSS and DOM using the developer tools? Maybe Images.jl somehow does some shrinking of the output if it thinks it too big for the screen? I don’t think Pluto.jl is to blame here.
Im not a html person really but I found the element, the png resource in “blob” is itself stored at a lower resolution, does that mean its a problem with Images.jl?
What excatly determines how the output is saved as an html resource?
begin
using Images
using TestImages
end
# run in successive cells to see fabio
# get larger and then smaller again.
imresize(testimage("fabio_color_512"); ratio= 1.0)
imresize(testimage("fabio_color_512"); ratio= 1.5)
imresize(testimage("fabio_color_512"); ratio= 2.0)
Ok yeah you can see that images are size controlled carefully on the output in the ImageShow package.
I guess since pluto just reuses show methods, this code (prevents your terminal from exploding with giant arrays) gets in the way. The modularity comes from using restrict factor-of-2 downsampling for speed. So I will try and remove this dependency and report back.
Edit: without ImageShow I cant display the images properly. maybe someone knows how to coordinate the iocontext :thumbnailsize with the base size of the image?
Edit2: I guess actually its the maxpixel term in corrected linked method here. How do I pass a different maxpixel keyword? I dont know what IO variable pluto is sending show.
I can overwrite the method buuuut seems a little risky.
I think I would do this but you don’t need to use eval. Just copy the relevant code of ImageShow where it defines the method in Base and add that to your notebook. That is sufficient to overwrite the method (and will cause some recompilation once). If the method is rather complex and uses a lot of ImageShow internals, then maybe you can find a simpler method to overwrite higher in the call stack.
Ok! I got the method overwritten, actually without any definitions from ImageShow.
function Base.show(io::IO, mime::MIME"image/png", img::AbstractMatrix{C}) where {C<:Colorant}
FileIO.save(FileIO.Stream{format"PNG"}(io), img)
end
and now everything is scaled to fit the window! It still kinda bothers me though that theres a keyword that does what I want and I cant use it but thats an aesthetic issue. I can go ahead and remove ImageShow entirely as a dependency.
Yep this is a feature of ImageShow! There is actually a way to control the IO context, using PlutoUI.WithIOContext. Normally, this lets you change flags for just that one render, like : full_fidelity => true.
But it’s not working in this very special case because of this whole thing…, and the HTML show method does not seem to get the IO context… weird! Well, I tried!