JPEG compression and the golden hour

Bill Smith
4 min readFeb 19, 2019

--

A Raspberry Pi in my office in downtown Austin, Texas takes time-lapse photos of Block 71, a construction site two blocks away. Last weekend, while experimenting with making time-lapse videos, I noticed something surprising about the image file sizes.

The Raspberry Pi takes a photo every 15 minutes. All the images are JPEG encoded and all are the same resolution. Since JPEGs are compressed, the file size depends on the original image. Here is a 24-hour plot of file sizes from last Friday:

JPEG file size (MB) over time for Feb 15 2019

The JPEGs are smaller at night and larger during the day. Night images are more uniform than day images, so they compress more. The Raspberry Pi uploads the files to a cloud account that I pay for, so night images are less expensive than day images.

The curve spikes around dawn and again around dusk. That’s not just a random artifact. Below are file size plots for the first week of January. (The vertical axis starts at 3MB rather than 0 to preserve vertical space.) As you can see, each day has a spike around sunrise and sundown.

JPEG file size (MB) over time for Jan 1 2019
JPEG file size (MB) over time for Jan 2 2019
JPEG file size (MB) over time for Jan 3 2019
JPEG file size (MB) over time for Jan 4 2019
JPEG file size (MB) over time for Jan 5 2019
JPEG file size (MB) over time for Jan 6 2019
JPEG file size (MB) over time for Jan 7 2019

Below are some photos before and after the morning and evening peak for January 1 and 4.

7 and 7:15, and 7:30 am on Jan 1 2019. Peak is at 7:15 am. (Cloudy day).
5:15, 5:30, and 5:45pm on Jan 1 2019. Peak is at 5:30pm. (Cloudy day).
7, 7:15, and 7:30am on Jan 4 2019. Peak is at 7:15. (Clear sky.)
5:45, 6, and 6:15pm on Jan 4 2019. Peak is at 6pm. (Clear sky.)

Once a week, I get up before sunrise and bike around a small lake with a friend. After crossing a dam, we turn west toward downtown. I especially enjoy that part of the ride; if the sky is clear, we catch the sun reflecting off the downtown skyscrapers just after the sun crosses over the horizon. The glass buildings look especially bright against the backdrop of the predawn sky to the west. The contrast is dramatic and I never get tired of it.

Photographers have a term for the period just after sunrise or just before sunset: the Golden hour. The sun’s low angle during Golden hour makes for interesting colors and dramatic contrasts. Apparently, Golden hour images are a little harder for the JPEG algorithm to compress, too.

--

--