Skip to content

html show method: use IOContext from original renderer#60

Open
fonsp wants to merge 1 commit intoJuliaImages:masterfrom
fonsp:patch-1
Open

html show method: use IOContext from original renderer#60
fonsp wants to merge 1 commit intoJuliaImages:masterfrom
fonsp:patch-1

Conversation

@fonsp
Copy link
Copy Markdown
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
Copy Markdown
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