Skip to content
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

html show method: use IOContext from original renderer #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fonsp
Copy link
Contributor

@fonsp fonsp commented Jun 8, 2024

Hey! I was working on https://discourse.julialang.org/t/making-images-as-big-as-possible-max-width-in-pluto-notebooks/115003/14 and noticed that when the HTML show method is used from ImageShow, any properties from the io context are ignored.

In particular, it is not possible to use the :full_fidelity property to control the HTML show method.

You can see this in this example:

Before

julia> using Colors, ImageShow, ImageIO

julia> img = rand(Gray, 2000, 2000);

julia> sprint() do io
                  show(io, MIME"text/html"(), img)
              end
249546

julia> sprint() do io
                  show(IOContext(io, :full_fidelity=>true), MIME"text/html"(), img)
              end |> length
249546

(the two outputs are the same)

After

julia> using Colors, ImageShow, ImageIO

julia> img = rand(Gray, 2000, 2000);

julia> sprint() do io
           show(io, MIME"text/html"(), img)
       end |> length
249658

julia> sprint() do io
           show(IOContext(io, :full_fidelity=>true), MIME"text/html"(), img)
       end |> length
5345654

(different, because full_fidelity has an effect)

@fonsp
Copy link
Contributor Author

fonsp commented Jun 11, 2024

Hey @johnnychen94 ! Could you take a look at the two open PRs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant