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

WIP: add TerminalGraphicDisplay for image/png #49

Merged
merged 3 commits into from
Aug 6, 2022
Merged

WIP: add TerminalGraphicDisplay for image/png #49

merged 3 commits into from
Aug 6, 2022

Conversation

johnnychen94
Copy link
Member

@johnnychen94 johnnychen94 commented May 15, 2021

closes #48

without sixel:

image

@@ -93,6 +97,8 @@ function __init__()
@warn "ImageInTerminal is not supported for Windows platform: Julia at least v1.6.0 is required."
disable_encoding()
end

pushdisplay(TerminalGraphicDisplay(stdout))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be ideal because if there're other GUI image viewers, we'd better use them. Currently, it seems that vscode is smart enough to figure the order out, I'll need to check other GUIs to see if it's also the same case.

julia> typeof.(Base.Multimedia.displays)
4-element Vector{DataType}:
 TextDisplay
 REPL.REPLDisplay{REPL.LineEditREPL}
 ImageInTerminal.TerminalGraphicDisplay{Base.TTY, Base.TTY}
 VSCodeServer.InlineDisplay

@johnnychen94 johnnychen94 mentioned this pull request May 15, 2021
9 tasks
@johnnychen94
Copy link
Member Author

johnnychen94 commented May 16, 2021

With sixel:

demo

Except for the latex compilation overhead which we cannot workaround in trivial ways, the result looks good to me.

@t-bltg
Copy link
Collaborator

t-bltg commented Dec 20, 2021

Create self contained examples for copy/paste:

without sixel

using ImageInTerminal, Latexify

main() = latexify(:(x/y)) |> s -> render(s, MIME("image/png"))

main()

with sixel 1

using Sixel, ImageInTerminal, Latexify

main() = @latexify([2+3i ∞; π x/(1/x + (y+x)^2)]) |> s -> render(s, MIME("image/png"))

main()

Footnotes

  1. for sixel support, code snippet must be ran under a compatible terminal.

@t-bltg
Copy link
Collaborator

t-bltg commented Dec 20, 2021

@johnnychen94, what's left to do for this PR to get merged ?

@johnnychen94
Copy link
Member Author

For the bigger picture of this package, I've commented in JuliaPlots/UnicodePlots.jl#196 (comment). For this PR I think it's mainly a functionality check and unit tests; I wasn't sure how this PR would affect the normal usage of vscode+julia, Atom+julia, and Jupyter+julia.

@t-bltg
Copy link
Collaborator

t-bltg commented Jul 28, 2022

It'd be great if we could merge this one, and add an option to remove the summary (not needed for equations).

@johnnychen94
Copy link
Member Author

johnnychen94 commented Aug 6, 2022

@t-bltg I think I might never have the time to really dive into this package in the near future, so feel free to do anything you like to ImageInTerminal and related.

@t-bltg
Copy link
Collaborator

t-bltg commented Aug 6, 2022

Thanks @johnnychen94, I might no be the best qualified to enhance ImageInTerminal, but is better to move forward and fix things that have stale PRs everywhere. So for this PR, if plan to :

  1. drop FileIO < 1.6
  2. disable summary by default by using TerminalGraphicDisplay(stdout, devnull) on __init__

Are you ok with these (and pushing in your branch ?)

After merging this one, I'll rework and merge #58.

@johnnychen94
Copy link
Member Author

Yes of course. You have made great progress to UnicodePlots -- a fantastical work. I believe if you put some effort into ImageInTerminal, this package will revive as well.

@t-bltg
Copy link
Collaborator

t-bltg commented Aug 6, 2022

Thanks ! I'll try my best ...
If you have comments or see that I'm destroying stuff don't hesitate to hit me :)

@t-bltg t-bltg marked this pull request as ready for review August 6, 2022 12:40
@t-bltg t-bltg merged commit ec6ab9a into master Aug 6, 2022
@t-bltg t-bltg deleted the jc/display branch August 6, 2022 12:42
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.

add TerminalDisplay and associated display function
2 participants