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

Add support to display PNG for arbitrary types #76

Merged
merged 2 commits into from
Oct 27, 2024

Conversation

jwortmann
Copy link
Contributor

This would allow to display images for arbitrary user types, as long as they provide an implementation for Base.show for the MIME type image/png as described at https://docs.julialang.org/en/v1/manual/types/#man-custom-pretty-printing.

Example:

julia> using PNGFiles, TesetImages, ImageInTerminal

julia> struct Foo end

julia> Base.show(io::IO, ::MIME"image/png", ::Foo) = PNGFiles.save(io, testimage("mandrill"))

julia> foo = Foo()

julia> display("image/png", foo)

ImageInTerminal

Copy link
Member

@johnnychen94 johnnychen94 left a comment

Choose a reason for hiding this comment

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

looks good

@t-bltg t-bltg merged commit 2408ad5 into JuliaImages:master Oct 27, 2024
6 checks passed
@jwortmann jwortmann deleted the display-any branch October 27, 2024 14:39
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.

3 participants