Release of ExifViewer.jl for Image Metadata : GSOC’22 Work Product

Ashwani Rathee
3 min readOct 14, 2022

In this post, we discuss Exif metadata and the launch of ExifViewer.jl to work with Exif metadata in image files in Julia.

Introduction

EXIF is short for Exchangeable Image File, a format that is a standard for storing interchange information in digital photography image files using JPEG compression. ExifViewer.jl provides support for encoding and decoding metadata from image files like jpeg, png, tiff. Let’s take the example of the below shown image as our image with metadata:

Let’s first try to load using Images.jl

Reading Image files in Julia.

FileIO successfully loads the image and returns an AbstractArray of size 960×2360 but doesn’t return associated metadata that gives information about the artist, camera settings, or image’s description.

We lose out on a lot of important details about the image. ExifViewer.jl solves this problem by reading the exif-metadata from the image, which we hope in the future will be integrated with the load function to return both image array and its associated metadata.

Let’s read image’s metadata with ExifViewer.jl:

Reading EXIF tags from a file.

We can also update using `write_tags`, let’s update EXIF_TAG_MAKE to Julia as it will be all done in Julia this time.

Write tags to a file.

Hurray!!!!!! We have updated the metadata of the image file.

There is a very interesting question: where is this data exactly stored in a file?

Let’s take an example of a .jpeg file, let’s generate a very simple jpeg file to understand its structure.

Below image shows the general structure of the jpeg file and EXIF data is supported in Application Marker 1:

JPEG File Structure

Exif data will be stored in APP1 whose start is marked by 0xFFE1 as we will see soon.
and some details about JPEG file structure, which tell where the image starts and ends, what markers mark the start of APP1 data, and where the compressed data is etc:

Various markers in JPEG file

Now, let’s see our image in its hexadecimal form:

Sample.jpeg

Our EXIF data is stored in APP1 which we try to decode and encode using EXIFViewer.jl.

Note!!!!

ExifViewer.jl is now available for the community’s use in Julia’s General Registry and can be simply installed using:

Adding ExifViewer.jl for use

Future Work

Currently a limited number of tags(around 40) are supported for writing to file that need to be extended and there are some known issues related to encoding. Also, encoding is limited to JPEG and JPG files right now which needs to be eventually extended to all available formats that can use exif specification.

Acknowledgments

Thank you @johnnychen94 for being constant support as a mentor and a friend over the years!!

--

--

Ashwani Rathee

From house of sangrinmid. I am a Julian. I like movies, music, code and everything stitch.