• Stars
    star
    113
  • Rank 308,130 (Top 7 %)
  • Language
    Julia
  • License
    Other
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Julia package for displaying images in the terminal using ANSI colors and Unicode characters

ImageInTerminal

ImageInTerminal is a drop-in package that once imported changes how a single Colorant and whole Colorant arrays (regular images) are displayed in the interactive REPL. The displayed images will be downscaled to fit into the size of your active terminal session.

To activate this package simply import it into your Julia session.

Without ImageInTerminal

julia> using Images, TestImages

julia> testimage("cameraman")
512×512 Array{Gray{N0f8},2}:
 Gray{N0f8}(0.612)  Gray{N0f8}(0.616)  …  Gray{N0f8}(0.596)
 Gray{N0f8}(0.612)  Gray{N0f8}(0.616)     Gray{N0f8}(0.596)
 Gray{N0f8}(0.62)   Gray{N0f8}(0.616)     Gray{N0f8}(0.596)
 Gray{N0f8}(0.612)  Gray{N0f8}(0.616)  …  Gray{N0f8}(0.6)
 Gray{N0f8}(0.62)   Gray{N0f8}(0.616)     Gray{N0f8}(0.6)
 ⋮                                     ⋱
 Gray{N0f8}(0.435)  Gray{N0f8}(0.439)     Gray{N0f8}(0.439)
 Gray{N0f8}(0.494)  Gray{N0f8}(0.475)  …  Gray{N0f8}(0.467)
 Gray{N0f8}(0.475)  Gray{N0f8}(0.482)     Gray{N0f8}(0.435)
 Gray{N0f8}(0.475)  Gray{N0f8}(0.482)  …  Gray{N0f8}(0.435)
 Gray{N0f8}(0.475)  Gray{N0f8}(0.482)     Gray{N0f8}(0.435)

julia> colorview(RGB, rand(3, 10, 10))
10×10 Array{RGB{Float64},2}:
 RGB{Float64}(0.272693,0.183303,0.0411779)  …  RGB{Float64}(0.743438,0.903394,0.0491672)
 RGB{Float64}(0.035006,0.220871,0.377436)      RGB{Float64}(0.341061,0.145152,0.675675)
 RGB{Float64}(0.164915,0.275161,0.737311)      RGB{Float64}(0.636575,0.460115,0.255893)
 RGB{Float64}(0.656064,0.904043,0.796598)      RGB{Float64}(0.764059,0.573298,0.373081)
 RGB{Float64}(0.203784,0.682884,0.61882)       RGB{Float64}(0.544405,0.934227,0.995363)
 RGB{Float64}(0.906384,0.820926,0.308954)   …  RGB{Float64}(0.00728851,0.996279,0.620743)
 RGB{Float64}(0.574717,0.423059,0.306321)      RGB{Float64}(0.506259,0.138856,0.322121)
 RGB{Float64}(0.0372145,0.60332,0.121911)      RGB{Float64}(0.591279,0.74032,0.876621)
 RGB{Float64}(0.328746,0.69418,0.397904)       RGB{Float64}(0.90115,0.734102,0.893911)
 RGB{Float64}(0.422224,0.914328,0.773111)      RGB{Float64}(0.448258,0.955572,0.0445449)

Using ImageInTerminal

julia> using Images, TestImages, ImageInTerminal

julia> testimage("cameraman")

julia> colorview(RGB, rand(3, 10, 10))

Example

Sixel encoder (Julia 1.6+)

If Sixel is supported by the terminal, this package will encode the content using a Sixel encoder for large images, and thus bring much better image visualization experience in terminal:

Sixel

However, do notice that not all terminals support sixel format. See Terminals that support sixel for more information.

Display equations

ImageInTerminal can be used to display latex equations from Latexify.jl, here on mlterm:

using ImageInTerminal, Latexify

render(latexify(:(iħ * (∂Ψ(𝐫, t) / ∂t) = -ħ^2 / 2m * ΔΨ(𝐫, t) + V * Ψ(𝐫, t))), dpi=200)

Latexify

8-bit (256) colors and 24-bit colors

By default this packages will detect if your running terminal supports 24-bit colors (true colors). If it does, the image will be displayed in 24-bit colors, otherwise it fallbacks to 8-bit (256 colors). To manually switch between 24-bit and 8-bit colors, you can use the internal helpers:

using ImageInTerminal
ImageInTerminal.set_colormode(8)
ImageInTerminal.set_colormode(24)

Note that 24 bits format only works as expected if your terminal supports it, otherwise you are likely to get some random outputs. To check if your terminal supports 24 bits color, you can check if the environment variable COLORTERM is set to 24bit (or truecolor).

Here's how images are displayed in 24-bit colors:

Cameraman

Enable and disable

If you want to temporarily disable this package, you can call ImageInTerminal.disable_encoding(). To restore the encoding functionality use ImageInTerminal.enable_encoding().

Troubleshooting

If you see out of place horizontal lines in your Image it means that your font displays the unicode block-characters in an unfortunate way. Try changing font or reducing your terminal's line-spacing. If your font is Source Code Pro, update to the latest version. It is recommended to use the JuliaMono font.

More Repositories

1

Images.jl

An image library for Julia
Julia
529
star
2

ImageView.jl

Interactive display of images and movies
Julia
135
star
3

ImageFiltering.jl

Julia implementations of multidimensional array convolution and nonlinear stencil operations
Julia
99
star
4

QRCoders.jl

Creating QR Codes within Julia
Julia
67
star
5

DitherPunk.jl

Dithering algorithms in Julia.
Julia
57
star
6

ImageSegmentation.jl

Partitioning images into meaningful regions
Julia
47
star
7

ImageTransformations.jl

Geometric transformations on images for Julia
Julia
46
star
8

ImageFeatures.jl

Image feature detection for the Julia language
Julia
44
star
9

ImageBinarization.jl

A Julia package of algorithms for analyzing images and automatically binarizing them into background and foreground.
Julia
35
star
10

OpenCV.jl

Use OpenCV in Julia!! 🚀
Julia
33
star
11

juliaimages.github.io

Documentation For JuliaImages
Julia
33
star
12

ExifViewer.jl

Metadata reader in Julia, wrapper over LibExif
Julia
27
star
13

ImageDraw.jl

Drawing Package for JuliaImages
Julia
27
star
14

ImageMorphology.jl

Morphological operations for image processing
Julia
27
star
15

ImageCore.jl

Julia types for representing images
Julia
27
star
16

ImageInpainting.jl

Image inpainting algorithms in Julia
Julia
26
star
17

ImageShow.jl

Inline graphical display of images in Julia graphical environments
Julia
26
star
18

ImageTracking.jl

Julia
26
star
19

TestImages.jl

commonly used test images
Julia
24
star
20

JuliaCon23_ImageProcessingWorkshop

Jupyter Notebook
22
star
21

ImageEdgeDetection.jl

A Julia package for determining image edges (up to subpixel precision) and ascertaining the gradient/edge orientations.
Julia
16
star
22

ImageDistances.jl

Distances between N-dimensional images
Julia
15
star
23

HistogramThresholding.jl

A Julia package for determining thresholds by analyzing one-dimensional histograms
Julia
12
star
24

ImageMetadata.jl

Julia package for images having metadata
Julia
11
star
25

QRDecoders.jl

OSPP'22 project repository for QR format decoder support
Julia
11
star
26

ImageContrastAdjustment.jl

A Julia package for enhancing and manipulating image contrast.
Julia
11
star
27

MultiChannelColors.jl

Encoding multichannel fluorescence and hyperspectral images
Julia
10
star
28

ImageCorners.jl

Corner Related Algorithms ⛶
Julia
9
star
29

ImageQualityIndexes.jl

Indexes for image quality assessment
Julia
9
star
30

ImageReconstruction.jl

Julia
8
star
31

ColorQuantization.jl

Color Quantization Algorithms in Julia
Julia
8
star
32

XTermColors.jl

Terminal image encoder / decoder
Julia
7
star
33

ImageSmooth.jl

Image smoothing algorithms
Julia
7
star
34

image_benchmarks

Cross-suite benchmarking
Julia
6
star
35

IntegralArrays.jl

Julia Implementation of Integral Arrays
Julia
5
star
36

ImagesAPI.jl

Lightweight API definitions reusable in other packages
Julia
5
star
37

ImageStitching.jl

Experimental image stitching project for GSoC'22
Julia
4
star
38

ImageBase.jl

Julia
4
star
39

QRCode.jl

The original version of https://github.com/JuliaImages/QRCoders.jl written by jiegillet
Julia
3
star
40

ImageAxes.jl

Julia package for giving "meaning" to the axes of an image
Julia
2
star
41

ImageCL.jl

Image processing with OpenCL
Julia
2
star
42

ProjectiveGeometry.jl

Projection, Warping, Transforms, Camera Geometry and 3D Reconstruction.
Julia
2
star
43

Tinker.jl

Interactive graphical tool for complex image analysis
Julia
2
star
44

ImageNoise.jl

Julia package that handles image noise
Julia
1
star
45

MultipleViewGeometry.jl

Multiple View Geometry
Julia
1
star