Reading TIFFs

Loading most TIFFs should just work, see Writing TIFFs for more advanced manipulation of TIFF objects. But we'll quickly run through a common use cases.

Basic loading

At its most basic, we can just point TiffImages.jl to the filepath of an image and it will attempt to load it. Here, we're loading spring.tif from the tlnagy/exampletiffs repo

using TiffImages
img = TiffImages.load(filepath)
Example block output

If you're a graphical environment, you can load the Images.jl repo to get a nice graphical representation of your image. If you're in the REPL, I highly recommend the ImageInTerminal.jl package for some visual feedback.

Continuing on, img here behaves exactly as you would expect a Julian array to despite the funky type signature

typeof(img)
TiffImages.DenseTaggedImage{RGB{Float16}, 2, UInt32, Matrix{RGB{Float16}}}

Everything should behave as expected

eltype(img)
RGB{Float16}
Note

If your reaction to this element type is "Whoa! What is that?", I highly recommend reading JuliaImages' primer on colors and types. TiffImages is well integrated with the JuliaImages ecosystem so the tutorials there are quite helpful for learning how to interact with the TiffImages' outputs

Accessing and setting data should work as expected

img[160:180, 50]
img[160:180, 50] .= 1.0
img
Example block output

This page was generated using Literate.jl.