ImageIO.jl

Load images in Julia. Designed for FileIO interaction. Supports PNG and Portable Bitmap formats
Author JuliaIO
Popularity
28 Stars
Updated Last
5 Months Ago
Started In
February 2020

ImageIO.jl

FileIO.jl integration for image files

Julia version CI Codecov

Format Extensions Provider Implementation Comment
JPEG .jpg, .jpeg JpegTurbo.jl Julia wrapper of libjpeg-turbo Benchmark results against other backends
OpenEXR .exr OpenEXR.jl Julia wrapper of OpenEXR
Portable Bitmap formats .pbm, .pgm, .ppm Netpbm.jl pure Julia
PNG (Portable Network Graphics) .png PNGFiles.jl Julia wrapper of libpng Benchmark vs. ImageMagick & QuartzImageIO
QOI (Quite Okay Image) format .qoi QOI.jl pure Julia
DEC SIXEL (six-pixels) graphics .six, .sixel Sixel.jl Julia wrapper of libsixel
TIFF (Tag Image File Format) .tiff, .tif TiffImages.jl pure Julia check OMETIFF.jl for OMETIFF support

Installation

Install with Pkg:

pkg> add ImageIO  # Press ']' to enter te Pkg REPL mode

Usage

using FileIO
save("test.png", rand(Gray, 100, 100))
load("test.png")
save("test.ppm", rand(RGB, 100, 100))
load("test.ppm")
save("test.tiff", rand(RGB, 100, 100))
load("test.tiff")

Canonicalization

Some image loaders may return custom AbstractArray types. By default, this package "canonicalizes" the returned type to be either Array or IndirectArray. An exception is for calls like load(filename; mmap=true) where the image data will be "lazily" loaded using memory-mapped IO, in which case the default is to allow the lower-level I/O package to return whatever AbstractArray type it chooses.

You can manually control canonicalization with load(filename; canonicalize=tf) where tf is true or false.

Compatibility

If you're using old Julia versions (VERSION < v"1.3"), a dummy ImageIO version v0.0.1 with no real function will be installed. In this case, you still need to install ImageMagick.jl to make FileIO.save/FileIO.load work.