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

Added support for previewing image in Livebook with Kino #25

Merged
merged 12 commits into from
Nov 8, 2022
Merged

Added support for previewing image in Livebook with Kino #25

merged 12 commits into from
Nov 8, 2022

Conversation

cocoa-xu
Copy link
Member

@cocoa-xu cocoa-xu commented Nov 6, 2022

If Kino is available, then defaults to the Image tab.

Screenshot 2022-11-06 at 02 13 57

If Kino and Nx are both available, then there will be a third Numerical Tab.

Screenshot 2022-11-06 at 02 16 04

If Kino and Nx are not available, the output is the same as previous versions.

Screenshot 2022-11-06 at 02 16 04

It's also possible to set the order of these tabs.

StbImage.kino_render_tab_order([:image, :raw])

Screenshot 2022-11-06 at 02 10 05

When the user set [:image, :raw, :numerical] while :nx is not available, the following message will be displayed to prompt the user to add :nx to the dependency list.

Screenshot 2022-11-06 at 02 09 30

And users can limit the maximum size for this feature. If either the height or width of the image exceeds that limit, the Image tab will not be shown.

Screenshot 2022-11-06 at 02 25 52

lib/stb_image.ex Outdated Show resolved Hide resolved
Co-authored-by: José Valim <jose.valim@gmail.com>
lib/stb_image.ex Outdated Show resolved Hide resolved
lib/stb_image.ex Outdated Show resolved Hide resolved
lib/stb_image.ex Outdated Show resolved Hide resolved
lib/stb_image.ex Outdated Show resolved Hide resolved
lib/stb_image.ex Outdated Show resolved Hide resolved
lib/stb_image.ex Outdated Show resolved Hide resolved
lib/stb_image.ex Outdated Show resolved Hide resolved
lib/stb_image.ex Outdated Show resolved Hide resolved
lib/stb_image.ex Outdated Show resolved Hide resolved
lib/stb_image.ex Outdated Show resolved Hide resolved
Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
@cocoa-xu
Copy link
Member Author

cocoa-xu commented Nov 8, 2022

Hi @josevalim @jonatanklosko, thank you very much for the code review and suggestions😊.

Sorry that I’m outside at the moment. I’ll review and update the code when I get home :) (if the PR is not merged by then

`image.shape` is always `{h, w ,c}`
@josevalim josevalim merged commit 2160444 into elixir-nx:main Nov 8, 2022
@cocoa-xu cocoa-xu deleted the cx-kino-preview branch November 8, 2022 12:21
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.

None yet

3 participants