Skip to content

Plugins and formats

JPEG, PNG, WebP, GIF, WebP and PNG (APNG) animations, TIFF (every page, and grey TIFFs of floats from science stretched to show), BMP, ICO, QOI, PNM, Radiance HDR (tone-mapped), Zeiss LSM and .gel scans, camera RAW files through their embedded preview, and HEIC, AVIF and video through ffmpeg, JPEG XL and SVG, as the packages are built.

Both are small desktop files in a folder of your own, which name a program. Glimt runs it directly, never through a shell, with each file as an argument of its own, so a file named $(rm -rf ~).jpg stays a name.

  • Plugins (~/.local/share/glimt/plugins) run a program on the selected files from Edit → Plugins: rotate them, send them somewhere, or describe them with a model on your own computer.
  • Decoder plugins (~/.local/share/glimt/decoders, Glimt 0.24.0 or newer) teach Glimt a format it does not read itself. The program gets a file and writes the image to its standard output; Glimt then lists, shows and makes thumbnails of such files as of any other.

They are in examples/decoders in Glimt's source, and each is tested in Glimt's release tests.

Decoder Formats Field Needs
dicom.desktop DICOM (.dcm), also compressed, in the window the file names medicine, dentistry python3-pydicom, python3-gdcm
nifti.desktop NIfTI (.nii, .nii.gz): the middle axial slice brain MRI, fMRI python3-nibabel
openslide.desktop Whole-slide images (.svs, .ndpi, .mrxs, .scn …) pathology python3-openslide
bioformats.desktop Zeiss .czi, Leica .lif, Nikon .nd2, Olympus .oib/.oir and more (ICS once added) microscopy Java and Bio-Formats' bftools
mrc.desktop MRC (.mrc, .map, .rec …): a micrograph or the middle section cryo-EM, structural biology python3-mrcfile
fits.desktop FITS (also .fits.fz), with astronomers' zscale stretch astronomy, solar physics python3-astropy
hdf5.desktop HDF5, NetCDF-4, NeXus (.h5, .nc, .nxs): the largest dataset of two or more dimensions climate, physics, satellites python3-h5py
jpeg2000.desktop JPEG 2000 (.jp2, .j2k, .jpf, .jpx) archives, libraries ffmpeg
photoshop.desktop Photoshop (.psd, .psb) as saved design, architecture ImageMagick
tga.desktop, exr.desktop TGA, OpenEXR renderings games, 3D ImageMagick
xcf.desktop GIMP's own files, their layers put together design ImageMagick
imagemagick-fits.desktop, imagemagick-dicom.desktop FITS and DICOM through ImageMagick alone astronomy, medicine ImageMagick

To use them, copy those you need with the script a desktop file names (glimt-fits for fits.desktop). Take one of each pair: fits.desktop or imagemagick-fits.desktop, dicom.desktop or imagemagick-dicom.desktop. With both, the first by name takes the files, also on a computer without the Python modules it needs.

Terminal window
git clone https://github.com/thornbux/glimt
mkdir -p ~/.local/share/glimt/decoders
cd glimt/examples/decoders
cp jpeg2000.desktop fits.desktop glimt-fits ~/.local/share/glimt/decoders/

Restart Glimt, and those files show in the list as images do. A decoder whose program is missing shows its error where the image would be.

They are for a quick look, not for measuring: the values are stretched to grey (between the 1st and 99th percentile, or zscale for FITS), and the scripts read only the slice or level they show. DICOM and NIfTI files can hold patient data: Glimt and its decoders only show the picture, print or keep no name, ID or other field, and send nothing anywhere.

[Glimt Decoder]
Name=JPEG 2000
Extensions=jp2;j2k;j2c;jpf;jpx
Exec=ffmpeg -v error -protocol_whitelist file -format_whitelist j2k_pipe -f j2k_pipe -i %f -frames:v 1 -f image2pipe -vcodec ppm -
  • Extensions: the file endings it takes, separated by ;; an ending may have two parts, as nii.gz. A format Glimt reads itself is never given to a plugin, and when two decoders take the same ending, the one whose file comes first by name does.
  • Exec: the command. %f is the file's absolute path, as one argument; it may stand inside a word, as ImageMagick's %f[0] for a file's first frame. A program next to the desktop file is found there, so a decoder can bring its own script.
  • The program writes the image to its standard output, as PNM, PNG, TIFF or any other format Glimt reads. It has 30 seconds and may write at most 512 MB; it is stopped after that, with everything it started.
  • New decoders are seen after a restart. In a Flatpak they run on the host.

Which formats go into Glimt, and which into plugins

Section titled “Which formats go into Glimt, and which into plugins”

A format is built into Glimt when the image library Glimt already uses reads it, with no new dependency: BMP, ICO, QOI and PNM came in that way, with a few lines each. A format that needs a large library, a library in C, or a program of its own becomes a decoder plugin, so Glimt stays small and fast for everyone, and those who need FITS or DICOM add one file. A decoder that works well is welcome in Glimt's examples/decoders: send a pull request with the desktop file, a line on what it needs, and a test in tools/release-tests/tests.sh.