Most users probably want to start with the
Images.jl package, which bundles much (but not all) of the functionality in JuliaImages.
Images (and possibly some additional packages) may be all you need to manipulate images programmatically. You can install
Images.jl via the package manager,
(v1.0) pkg> add Images
People in some regions such as China might fail to install/precompile
Images due to poor network status. Using proxy/VPN that has stable connection to Amazon S3 and Github can solve this issue.
As of Images v0.24.0,
ImageMagick IO backends are automatically installed.
If this is your first time working with images in julia, it's likely that you'll need to install some image IO backends to load the images. The current available backends for image files are:
- ImageMagick.jl covers most image formats and has extra functionality. This can be your first choice if you don't have a preference.
- QuartzImageIO.jl exposes macOS's native image IO functionality to Julia. In some cases it's faster than ImageMagick, but it might not cover all your needs.
- ImageIO.jl is a new image IO backend (requires julia >=v"1.3") that provides an optimized performance for PNG files. Check benchmark here
- OMETIFF.jl supports OME-TIFF files. If you don't know what it is, then it is likely that you don't need this package.
These backends aren't exclusive to each other, so if you're a macOS user, you can install all these backends. And in most cases, you don't need to directly interact with these backends, instead, we use the
load provided by the
FileIO.jl frontend. If you've installed multiple backends then
FileIO will choose the most appropriate backend acoording to your file format. For example, if available
ImageIO is used to load PNG files.
Adding these gives you a basic image IO setup:
(v1.0) pkg> add FileIO ImageMagick ImageIO
and to load an image, you can use
using Images, FileIO # specify the path to your local image file img_path = "/path/to/image.png" img = load(img_path)
To save an image, you can just use
save(img_path, img), where
save is also provided by
When testing ideas or just following along with the documentation, it can be useful to have some images to work with. The TestImages.jl package bundles several "standard" images for you.
(v1.0) pkg> add TestImages
To load one of the images from this package, say
using TestImages # backends such as ImageMagick are required img = testimage("mandrill")
Currently there're five julia packages can be used to display an image:
ImageShowis used to support image display in Juno and IJulia. This happens automatically if you are
ImageInTerminalis used to support image display in terminal.
ImageViewis an image display GUI. (For OSX and Windows platforms, Julia at least
Plotsmaintained by JuliaPlots is a general plotting package that support image display.
Makieis also maintained by JuliaPlots but provides rich interactive functionality.
To visualize multiple images in one frame, you can create a bigger image from multiple image sources with
mosaicview, which is an enhanced version of
img1 = testimage("mandrill") # 512*512 RGB image img2 = testimage("blobs") # 254*256 Gray image mosaicview(img1, img2; nrow=1)