JuliaImages / ImageInTerminal.jl

Julia package for displaying images in the terminal using ANSI colors and Unicode characters
Other
113 stars 13 forks source link

Add support to display PNG for arbitrary types #76

Closed jwortmann closed 2 weeks ago

jwortmann commented 5 months ago

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