<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>exif &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/exif/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Mon, 29 Dec 2025 10:37:03 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>exif &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Extracting Video from Motion Photos on Linux]]></title>
		<link>https://shkspr.mobi/blog/2025/12/extracting-video-from-motion-photos-on-linux/</link>
					<comments>https://shkspr.mobi/blog/2025/12/extracting-video-from-motion-photos-on-linux/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 28 Dec 2025 12:34:22 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[exif]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[photos]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=66565</guid>

					<description><![CDATA[Modern Android cameras can take &#34;Motion Photos&#34;. They capture a few seconds of video from before and after you hit the shutter button. You can then either select the bit of the photo where no-one is blinking, or you can send the whole thing as a little movie.  Some apps (like WhatsApp) will play the motion photo when the image is selected, others will just show a static image.  So how do you…]]></description>
										<content:encoded><![CDATA[<p>Modern Android cameras can take "Motion Photos". They capture a few seconds of video from before and after you hit the shutter button. You can then either select the bit of the photo where no-one is blinking, or you can send the whole thing as a little movie.</p>

<p>Some apps (like WhatsApp) will play the motion photo when the image is selected, others will just show a static image.</p>

<p>So how do you extract the movie from the image using Linux?</p>

<p>Step one, let's take a look at the EXIF metadata in the image. Here's what running <code>exiftool photo.MP.jpg</code> gets:</p>

<pre><code class="language-_">Motion Photo                    : 1
Motion Photo Version            : 1
Motion Photo Presentation Timestamp Us: 866808
Directory Item Mime             : image/jpeg, image/jpeg, video/mp4
Directory Item Semantic         : Primary, GainMap, MotionPhoto
Directory Item Length           : 46353, 2106347
Directory Item Padding          : 0
MPF Version                     : 0100
Number Of Images                : 2
MP Image Flags                  : (none)
MP Image Format                 : JPEG
MP Image Type                   : Undefined
MP Image Length                 : 46353
MP Image Start                  : 2570425
</code></pre>

<p>That can be cross-referenced with the <a href="https://developer.android.com/media/platform/motion-photo-format">Motion Photo metadata specification</a>.</p>

<p>We can confirm this is a Motion Photo, Version 1. The video portion at 866,808 microseconds (about 0.8 seconds) is where the main photo is taken from.</p>

<p>The file starts with the image, then a GainMap (for HDR), and then the video.</p>

<p>Somewhat obtusely (in my opinion) the Directory Item Length only shows "secondary media items" - in this case, the GainMap and Video.</p>

<p>The filesize is 4,723,125 bytes, which equals the sum of the three values; 46,353 + 2,106,347 + 2,570,425.</p>

<p>So, to get the MP4 video, we need to extract the <em>last</em> 2,106,347 bytes. This can be double-checked by taking the filesize and subtracting the MP Image Start and the MP Image Lengths (4,723,125 - 46,353 - 2,570,425 = 2,106,347).</p>

<p>The extraction can be done with <code>dd</code> but it's probably just as easy to use <code>tail</code> to read the last N bytes of a file:</p>

<p><code>tail -c 2106347 photo.MP.jpg &gt; video.mp4</code></p>

<p>You can verify that the video is valid by running <code>ffmpeg -i video.mp4</code> - the output will be lower resolution than the photo and will only be a few seconds long. It will play in VLC or any other standard player.</p>

<h2 id="try-it-yourself"><a href="https://shkspr.mobi/blog/2025/12/extracting-video-from-motion-photos-on-linux/#try-it-yourself">Try It Yourself</a></h2>

<p>Here's one of my motion photos - it should present in your browser as a still image, but run the above code to extract the video.</p>

<p><a href="https://shkspr.mobi/blog/wp-content/uploads/2025/12/PXL_20251220_224052239.MP_.bk.jpg"><img src="https://shkspr.mobi/blog/wp-content/uploads/2025/12/PXL_20251220_224052239.MP_.jpg" alt="Photo of a wind turbine." width="3072" height="4080" class="aligncenter size-full wp-image-66570"></a></p>

<p>Click the photo to download the full version rather than the optimised one.</p>

<h2 id="sources"><a href="https://shkspr.mobi/blog/2025/12/extracting-video-from-motion-photos-on-linux/#sources">Sources</a></h2>

<p>For other adventures in Motion Photo exploration, take a look at:</p>

<ul>
<li><a href="https://developer.android.com/media/platform/motion-photo-format">https://developer.android.com/media/platform/motion-photo-format</a></li>
<li><a href="https://motion-live.js.org/">https://motion-live.js.org/</a></li>
<li><a href="https://medium.com/android-news/working-with-motion-photos-da0aa49b50c">https://medium.com/android-news/working-with-motion-photos-da0aa49b50c</a></li>
</ul>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=66565&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2025/12/extracting-video-from-motion-photos-on-linux/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Should you embed alt text inside image metadata?]]></title>
		<link>https://shkspr.mobi/blog/2023/07/should-you-embed-alt-text-inside-image-metadata/</link>
					<comments>https://shkspr.mobi/blog/2023/07/should-you-embed-alt-text-inside-image-metadata/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Fri, 28 Jul 2023 11:34:13 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[a11y]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[AltText]]></category>
		<category><![CDATA[exif]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=46340</guid>

					<description><![CDATA[Not everyone can see the images you post online. They may have vision problems, they may have a slow connection, or they might be using a text-only browser. How can we let them know what the image shows? The answer is alt text. In HTML we can add a snippet of text to aid accessibility.  For example &#60;img src=&#34;monalisa.jpg&#34; alt=&#34;A painting of the Mona Lisa.&#34;&#62;  Most social networks will let users…]]></description>
										<content:encoded><![CDATA[<p>Not everyone can see the images you post online. They may have vision problems, they may have a slow connection, or they might be using a text-only browser. How can we let them know what the image shows? The answer is <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt">alt text</a>. In HTML we can add a snippet of text to aid accessibility.</p>

<p>For example <code>&lt;img src="monalisa.jpg" alt="A painting of the Mona Lisa."&gt;</code></p>

<p>Most social networks will let users add alt text to help describe their images. Brilliant!</p>

<p>But... People don't always add alt text when they upload an image. They may not realise it is helpful, or they don't know how to write a good description, or they may not have time to write something suitable.  This leads to a frequently asked question: "Should I embed the alt text <em>inside</em> the image file? That way, whenever people share the image the alt text will automatically be attached!"</p>

<p>Here's my attempt to answer that.</p>

<h2 id="short-answer"><a href="https://shkspr.mobi/blog/2023/07/should-you-embed-alt-text-inside-image-metadata/#short-answer">Short answer</a></h2>

<p>No.</p>

<h2 id="long-answer"><a href="https://shkspr.mobi/blog/2023/07/should-you-embed-alt-text-inside-image-metadata/#long-answer">Long answer</a></h2>

<p>Nooooooooooooo!</p>

<h2 id="reasoned-answer"><a href="https://shkspr.mobi/blog/2023/07/should-you-embed-alt-text-inside-image-metadata/#reasoned-answer">Reasoned Answer</a></h2>

<p>It is complicated.</p>

<p>On a technical level, yes. Most modern image formats allow you to add image <em>metadata</em> - known as EXIF. This EXIF commonly contains GPS location, timestamps, make and model of camera, etc. Here's an example from one of my photos:</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2023/07/exifinfo-fs8.png" alt="Screenshot showing technical details of the metadata on a photo. It contains a copyright notice." width="1024" height="560" class="aligncenter size-full wp-image-46358">

<p>There are a <a href="https://exiftool.org/TagNames/EXIF.html">pre-defined list of acceptable EXIF tags</a> one of which is "ImageDescription", which is <a href="https://exiv2.org/Exif2-2.PDF">defined as</a>:</p>

<blockquote><p>A character string giving the title of the image. It may be a comment such as "1988 company picnic" or the like. Two-byte character codes cannot be used. When a 2-byte code is necessary, the Exif Private tag UserComment is to be used.</p></blockquote>

<p>So, there you have it. Yes you <em>can</em> embed text inside an image. With the right software you can read it. So, technically, you can stuff alt text in there and have a website automatically add it to the <code>alt</code> attribute.</p>

<p>But this is only <em>half</em> the story. What an image represents is highly context dependent.</p>

<p>In her article about <a href="https://tink.uk/thoughts-on-screen-readers-and-image-recognition/">using AI to automatically provide image captions</a>, Léonie Watson makes that point that alt text needs to be:</p>

<blockquote><p>provided by a content author who knows exactly what's in the image, why its being used and the context its being used in.</p></blockquote>

<p>Take this very real photo of a famous actress who I just got an AI to dream up.</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2023/07/Woman-celebrity-red-dress-smiling-evil-eyes-holding-a-knife-red-carpet-arm-tattoo.jpg" alt="An AI generate image based on the text &quot;Woman, celebrity, red dress, smiling, evil eyes, holding a knife, red carpet, arm tattoo.&quot;" width="512" height="512" class="aligncenter size-full wp-image-46359">

<p>What's a suitable alt text for this image?</p>

<ul>
<li>Famous actress Claire Flumptron standing on the red carpet.</li>
<li>Claire Flumptron shows off her brand new arm tattoo which has strange mystic runes covering her forearm.</li>
<li>Designer Giovanni Tuccini's new red dress has a small strap over the shoulder.</li>
<li>AI image where the hand is strangely deformed and the neck looks twisted beyond human endurance.</li>
<li>Smiling woman with cropped blonde hair and heavy eye makeup.</li>
<li>Last known photo of the Mayor (right). His blurry face is smiling.</li>
<li>...</li>
</ul>

<p>There's no "right" answer. It depends on <em>what</em> the image is being used to illustrate.</p>

<p>A picture may be worth a thousand words. But those thousand words depend on context.</p>

<hr>

<p><ins datetime="2025-10-07T09:03:26+00:00">Update</ins> Here's another good example of embedded alt text failing badly.</p>

<div class="activitypub-embed u-in-reply-to h-cite"> <div class="activitypub-embed-header p-author h-card"> <img class="u-photo" src="https://files.mastodon.social/accounts/avatars/000/007/112/original/37df032a5951b96c.jpg" alt=""> <div class="activitypub-embed-header-text"> <h2 class="p-name" id="terence-eden"><a href="https://shkspr.mobi/blog/2023/07/should-you-embed-alt-text-inside-image-metadata/#terence-eden">Terence Eden</a></h2> <a href="https://mastodon.social/users/Edent" class="ap-account u-url">@Edent@mastodon.social</a> </div> </div> <div class="activitypub-embed-content"> <div class="ap-subtitle p-summary e-content"><p>Whenever people talk about embedding alt text into images, I remember that lots of gif search services already try to do that.</p><p>Here's BlueSky's gif service. I searched for some popular memes. Each had alt-text baked in.</p><p>Take a look and tell me if you think that the embedded text conveys the sentiment of the image? If you couldn't see the animation, would you understand what was going on from that alt?</p></div> <div class="ap-preview layout-4"> <img class="u-photo u-featured" src="https://files.mastodon.social/media_attachments/files/115/165/042/975/730/482/original/1e7cc65db6887d11.png" alt="The idiot sandwich meme. The default alt text is &quot;a man is holding a piece of bread over a woman 's face and asking what are you ?&quot;"> <img class="u-photo u-featured" src="https://files.mastodon.social/media_attachments/files/115/165/042/976/199/735/original/dd22dab9aa5a0fb1.png" alt="Clip from The Hobbit with the subtitle &quot;What about second breakfast?&quot;. The default alt text is &quot;two men are standing next to each other talking about second breakfast&quot;."> <img class="u-photo u-featured" src="https://files.mastodon.social/media_attachments/files/115/165/042/985/649/025/original/91e0e747e8e4da5a.png" alt="The meme of Homer Simpson walking backwards into a hedge. The default alt text is &quot;A cartoon of homer simpson standing in a grassy area.&quot;"> <img class="u-photo u-featured" src="https://files.mastodon.social/media_attachments/files/115/165/042/993/873/973/original/f97c27accad5c0f9.png" alt="The Chuckle Brothers looking at each other. The default alt text is &quot;a man in a striped shirt is kissing another man in a white suit&quot;."> </div> </div> <div class="activitypub-embed-meta"> <a href="https://mastodon.social/users/Edent/statuses/115165068315048568" class="ap-stat ap-date dt-published u-in-reply-to">2025-09-07, 21:11</a> <span class="ap-stat"> <strong>12</strong> boosts </span> <span class="ap-stat"> <strong>22</strong> favorites </span> </div> </div>

<style>/** * ActivityPub embed styles. */ .activitypub-embed { background: #fff; border: 1px solid #e6e6e6; border-radius: 12px; padding: 0; max-width: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; } .activitypub-reply-block .activitypub-embed { margin: 1em 0; } .activitypub-embed-header { padding: 15px; display: flex; align-items: center; gap: 10px; } .activitypub-embed-header img { width: 48px; height: 48px; border-radius: 50%; } .activitypub-embed-header-text { flex-grow: 1; } .activitypub-embed-header-text h2 { color: #000; font-size: 15px; font-weight: 600; margin: 0; padding: 0; } .activitypub-embed-header-text .ap-account { color: #687684; font-size: 14px; text-decoration: none; } .activitypub-embed-content { padding: 0 15px 15px; } .activitypub-embed-content .ap-title { font-size: 23px; font-weight: 600; margin: 0 0 10px; padding: 0; color: #000; } .activitypub-embed-content .ap-subtitle { font-size: 15px; color: #000; margin: 0 0 15px; } .activitypub-embed-content .ap-preview { border: 1px solid #e6e6e6; border-radius: 8px; overflow: hidden; } .activitypub-embed-content .ap-preview img { width: 100%; height: auto; display: block; } .activitypub-embed-content .ap-preview { border-radius: 8px; box-sizing: border-box; display: grid; gap: 2px; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; margin: 1em 0 0; min-height: 64px; overflow: hidden; position: relative; width: 100%; } .activitypub-embed-content .ap-preview.layout-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; } .activitypub-embed-content .ap-preview.layout-2 { aspect-ratio: auto; grid-template-rows: 1fr; height: auto; } .activitypub-embed-content .ap-preview.layout-3 > img:first-child { grid-row: span 2; } .activitypub-embed-content .ap-preview img { border: 0; box-sizing: border-box; display: inline-block; height: 100%; object-fit: cover; overflow: hidden; position: relative; width: 100%; } .activitypub-embed-content .ap-preview video, .activitypub-embed-content .ap-preview audio { max-width: 100%; display: block; grid-column: 1 / span 2; } .activitypub-embed-content .ap-preview audio { width: 100%; } .activitypub-embed-content .ap-preview-text { padding: 15px; } .activitypub-embed-meta { padding: 15px; border-top: 1px solid #e6e6e6; color: #687684; font-size: 13px; display: flex; gap: 15px; } .activitypub-embed-meta .ap-stat { display: flex; align-items: center; gap: 5px; } @media only screen and (max-width: 399px) { .activitypub-embed-meta span.ap-stat { display: none !important; } } .activitypub-embed-meta a.ap-stat { color: inherit; text-decoration: none; } .activitypub-embed-meta strong { font-weight: 600; color: #000; } .activitypub-embed-meta .ap-stat-label { color: #687684; } </style>

<hr>

<p>For more information on writing good alt text, see <a href="https://accessibility.huit.harvard.edu/describe-content-images">Harvard's Digital Accessibility​ blog</a> and <a href="https://design102.blog.gov.uk/2022/01/14/whats-the-alternative-how-to-write-good-alt-text/">Design102's guide</a>.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=46340&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2023/07/should-you-embed-alt-text-inside-image-metadata/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Reducing GPS accuracy in photos]]></title>
		<link>https://shkspr.mobi/blog/2020/10/reducing-gps-accuracy-in-photos/</link>
					<comments>https://shkspr.mobi/blog/2020/10/reducing-gps-accuracy-in-photos/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Thu, 01 Oct 2020 11:56:50 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[exif]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[metadata]]></category>
		<category><![CDATA[photography]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=36818</guid>

					<description><![CDATA[Here&#039;s a quick one-liner to reduce the precision of location stored in a photo&#039;s EXIF metadata:  exiftool -c &#34;%.2f&#34; -TagsFromFile @ -GPSLatitude -GPSLongitude photo.jpg   (Thanks to the EXIFtool Forum for their help.)  Why is this useful?  Modern phones automatically attach a GPS location to every photo you take. GPS resolution is around 10 metres. When you share your photos, you&#039;re often sharing …]]></description>
										<content:encoded><![CDATA[<p>Here's a quick one-liner to reduce the precision of location stored in a photo's EXIF metadata:</p>

<pre><code class="language-bash">exiftool -c "%.2f" -TagsFromFile @ -GPSLatitude -GPSLongitude photo.jpg
</code></pre>

<p>(Thanks to the <a href="https://exiftool.org/forum/index.php?topic=11651.new;topicseen#new">EXIFtool Forum</a> for their help.)</p>

<h2 id="why-is-this-useful"><a href="https://shkspr.mobi/blog/2020/10/reducing-gps-accuracy-in-photos/#why-is-this-useful">Why is this useful?</a></h2>

<p>Modern phones automatically attach a GPS location to every photo you take. GPS resolution is around 10 metres. When you share your photos, you're often sharing your <em>precise</em> location.</p>

<p>I wanted to upload some photos to the Wikimedia Commons of <a href="https://shkspr.mobi/blog/2020/09/opening-a-rediffusion-junction-box/">an interesting junction box installed in our home</a>.  I didn't want my home location stored on the Internet forever - but I thought it would be useful to include a <em>rough</em> location.</p>

<p>The above command takes a location of <code>51.123456,0.987654</code> and returns <code>51.12,0.98</code>.  That's good enough to roughly show the location, without revealing it exactly.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=36818&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2020/10/reducing-gps-accuracy-in-photos/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
