NOW LET US – AI RAG SaaS Studio TP.HCM
NOW LET US
Digital Product Studio
Back to news
DEV-TOOLS...6 min read

Appreciating Exif

Share
NOW LET US Article – Appreciating Exif

An insightful exploration of Exif metadata, detailing its structure, storage locations, and practical applications in image processing.

I recently was writing some code to apply a mask to an image input. The mask had no Exif metadata, but the image did, so I had to adjust for the orientation of the image by reading it from Exif.

This isnât hard with libraries, and I knew the gist of the problem: images can have Exif, Exif is optional, phones and cameras use it for orientation, and you need to account for that when processing pixels directly. But I did not have a clear mental model of how Exif actually is represented in files.

I was curious. I had questions:

Where exactly is that orientation value stored? When should I rotate pixels instead of preserving a tag? What else might be hiding in the metadata? When is it typically stripped?

So this is a little random walk guide to Exif.

What is Exif?

Exif is short for Exchangeable Image File Format. The current standard comes from CIPA, which lists it as âExchangeable image file format for digital still cameras: Exif Version 3.1.â1 The Library of Congress has a good preservation-oriented summary, too. Youâll often see EXIF

in all caps in camera docs, file-format chunk names, and old forum posts, but Exif

seems to be the normal spelling in the standard itself.

It is a metadata format that came out of the digital camera world in 1995, back when the problem was something like: this camera produced a JPEG, but where do we put the timestamp, shutter speed, aperture, focal length, thumbnail, and the fact that the camera was sideways?

The answer was Exif.

Most people run into this data through images from phones and cameras. It is also closely related to TIFF, because the actual Exif payload is a TIFF-shaped data structure living inside another file. Newer formats can carry Exif too, but each format gives it a different house.2

Itâs optional. An image can have none. A camera image probably has some, but a processed image may have had it stripped. A synthetic image can have fake Exif because metadata is just data someone wrote into the file.

Where it lives

For JPEG, Exif usually lives near the beginning of the file in an APP1

marker segment.

A JPEG starts with two bytes:

FF D8

That is the start-of-image marker. After that, a JPEG is a series of marker segments. Each segment starts with FF

and a marker byte. APP1 is:

FF E1

If that APP1 segment contains Exif, its payload starts with:

45 78 69 66 00 00

or, as text:

Exif\0\0

Then comes the TIFF-based part. It starts with a byte order marker:

II // Intel, little-endian
MM // Motorola, big-endian

Then the TIFF magic number, 42

, then an offset to the first Image File Directory, usually called IFD0. An IFD is a list of entries. Each entry has a tag id, a type, a count, and either a value or an offset to the value.

Exif orientation is tag 0x0112

. It is usually in IFD0. Its value is a small integer from 1 to 8.

That is the whole trick at a very high level. A tool looking for Exif in a JPEG:

  • walks the JPEG markers to find APP1,
  • checks for Exif\0\0

, - reads the TIFF header,

  • follows the IFD entries, and
  • looks for the tags it cares about.

So the âwhere is Exif?â depends on the file. In JPEG, it is usually APP1. In WebP, it is an EXIF

chunk. In HEIC, it is inside the HEIF box structure. If you want a lovely older walkthrough of the JPEG layout, the MIT Media Labâs Deep View project has one.

A boring standard that aged well

I have a soft spot for simple standards that just keep working.

Exif is not clean in the way you might design something from scratch today. It has TIFF internals. It has manufacturer MakerNotes. It has duplicate concepts across Exif, XMP, IPTC, ICC profiles, C2PA, and container metadata. The orientation tag feels simple until you try to explain values 5 and 7.

It has continued to solve a real problem, though: pixels are not enough. A camera needs somewhere to put the circumstances of the image, and itâs simpler for everyone if that data is bundled into the image rather than shipped around as an accompanying file.

I admire it because it grew out of its initial container. In JPEG, Exif usually sits in APP1. In newer file formats like HEIC, it lives somewhere else. But the same payload format still applies. A phone in 2026 can take a photo in a modern container and still carry metadata shaped by decisions from the digital camera era.

What Exif is used for

The common stuff is what you would expect from a camera:

  • date and time
  • camera make and model
  • lens model
  • shutter speed
  • aperture
  • ISO
  • focal length
  • flash
  • GPS location
  • orientation
  • software
  • color-space hints
  • manufacturer-specific MakerNotes

Thumbnails are a âmaybeâ: Exif can carry an embedded thumbnail, usually in IFD1.3 It commonly is a small embedded thumbnail. Larger previews are messier. Some are Exif thumbnails, some are MakerNotes, some are MPF data, and some live in container-specific metadata.

This is not everything. It is the usual useful slice. Photo apps use this data to sort, search, display, group, and edit images. Websites and upload pipelines use it, sometimes accidentally, to rotate images correctly. Photographers use it to inspect how a shot was made. Asset-management systems use it alongside other metadata standards for rights, captions, credits, and workflow state.

Color is a good example of boundaries blurring. Exif has a ColorSpace

tag, but full ICC color profiles are a separate kind of metadata.4 If an image changed size, rotated, lost its color, or started displaying differently after a pipeline step, metadata is one of the first places I would look, but I would not assume the answer is specifically Exif.

And of course, metadata is just whatever was put in the file. A file can say it came from a camera it did not come from. Timestamp can be wrong, GPS can be fake, a string field can contain gobblygook.

Use exiftool first

If you are doing anything technical with image metadata, start with exiftool

.

It is Perl and is old in the very good way. It has baked into it all sorts of knowledge about metadata weirdnesses that exist in real files.

The basic command is:

exiftool image.jpg

Here is the top of a real iPhone JPEG:

ExifTool Version Number : 13.55
File Name : image.jpg
Directory : /tmp
File Size : 3.6 MB
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
JFIF Version : 1.01
Exif Byte Order : Big-endian (Motorola, MM)
Make : Apple
Camera Model Name : iPhone 13
Orientation : Rotate 90 CW
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Software : 26.3.1
Modify Date : 2026:04:21 20:05:42
Host Computer : iPhone 13
Exposure Time : 1/317
F Number : 1.6
Exposure Program : Program AE
ISO : 50
Exif Version : 0232
Date/Time Original : 2026:04:21 20:05:42
Create Date : 2026:04:21 20:05:42

And that is just the start. The full output keeps going: MakerNotes, GPS, an embedded thumbnail, MPF data, and an ICC profile.

For debugging, itâs nice to have groups and raw-ish tag names:

exiftool -a -G1 -s image.jpg

An excerpt from the same file looks like this:

[File] ExifByteOrder : Big-endian (Motorola, MM)
[File] ImageWidth : 4032
[File] ImageHeight : 3024
[JFIF] XResolution : 300
[JFIF] YResolution : 300
[IFD0] Make : Apple
[IFD0] Model : iPhone 13
[IFD0] Orientation : Rotate 90 CW
[IFD0] XResolution : 72
[IFD0] YResolution : 72
[ExifIFD] ExposureTime : 1/317
[ExifIFD] FNumber : 1.6
[ExifIFD] ISO : 50
[ExifIFD] DateTimeOriginal : 2026:04:21 20:05:42
[ExifIFD] FocalLength : 5.1 mm
[ExifIFD] LensModel : iPhone 13 back dual wide camera 5.1mm f/1.6
[Apple] MakerNoteVersion : 16
[Apple] AccelerationVector : -0.0088618109 -0.1003010348 -1.003354311
[GPS] GPSLatitude : [redacted, because this is the internet]
[GPS] GPSLongitude : [redacted, same reason]
[GPS] GPSHPositioningError : 20.61573126 m
[IFD1] ThumbnailLength : 6400
[MPF0] NumberOfImages : 2
[ICC_Profile] ProfileDescription : Display P3

This is why I like the grouped view. Orientation is

© 2026 Now Let Us. All rights reserved.

Source: Hacker News

Advertisement
Ad slot ready: 5887729102

More in this category

NOW LET US Related – GLM 5.2 Is Out

dev-tools

GLM 5.2 Is Out

Zhipu AI has officially released GLM-5.2, its most powerful open-source model to date, featuring a 1M context window and advanced long-horizon task capabilities. The release underscores Zhipu's commitment to open-source AI and global scientific collaboration amid rising technological restrictions.

NOW LET US Related – Noise infusion banned from statistical products published by Census Bureau

dev-tools

Noise infusion banned from statistical products published by Census Bureau

The U.S. Department of Commerce has banned "noise infusion" from statistical products published by the Census Bureau, a decision that could have severe consequences for both data utility and privacy protection.

NOW LET US Related – Treating pancreatic tumours may have revealed cancer's master switch

dev-tools

Treating pancreatic tumours may have revealed cancer's master switch

A promising new drug called daraxonrasib has shown breakthrough results in treating pancreatic cancer, doubling median survival times. This achievement could pave the way for an entirely new class of cancer treatments.

NOW LET US Related – Every Frame Perfect

dev-tools

Every Frame Perfect

In UI design, perfection isn't just about the start and end states, but every single transition frame in between. Polishing these micro-interactions is key to building user trust.

NOW LET US Related – Leaving Mozilla

dev-tools

Leaving Mozilla

A poignant and candid reflection from a 15-year Mozilla veteran upon their departure. The author highlights the leadership's missteps in trying to emulate tech giants and urges Mozilla to return to its core values: community and uniqueness.

NOW LET US Related – Shepherd's Dog: A Game by the Most Dangerous AI Model

dev-tools

Shepherd's Dog: A Game by the Most Dangerous AI Model

A developer tested Anthropic's latest, supposedly 'too dangerous' AI model by asking it to build a long-held game idea in a single shot. The model succeeded, generating a complete 2,319-line game after a 45-minute reasoning session.

EXPLORE TOPICS

Discover All Categories

Deep dive into the specific technology sectors that matter most to you.