In a IJulia notebook, I have a cell that load an image from my filesystem then split it into few other images but when they are displayed, they are too small.
using Images
using FileIO
path = "samples/201478670932639746-3.png"
img = load(path)
height, width = size(img)
print((height, width))
lines = [
(@view img[20:55, :]),
(@view img[70:105, :]),
(@view img[120:155, :]),
(@view img[155:end, :])
]
The result look like this:
I've looked into the html code of and image:
<img style="max-width: 100px; max-height:100px;display:inline" src="data:image/png;base64,some_base64_data">
So i read the documentation of JuliaImages
for looking how images are displayed on notebook:
https://juliaimages.org/latest/quickstart/#Display-1
We can read here the package ImageShow
is used for display image on notebook
So i jump on the source code of the package on github:
https://github.com/JuliaImages/ImageShow.jl/blob/master/src/showmime.jl#L114
w,h=get(io, :thumbnailsize, (100,100))
im_resized = downsize_for_thumbnail(img, w, h)
thumbnail_style = get(io, :thumbnail, false) ? "max-width: $(w)px; max-height:$(h)px;" : ""
we can see here they are looking for :thumbnail
in io
, and the default value is (100,100)
I suppose io
is a IOContext
given by the notebook
So, how can i write into the IOContext
of an IJulia notebook for change thumbnail size ?