<?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>Reverse Engineering &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/reverse-engineering/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Tue, 11 Feb 2025 17:57:26 +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>Reverse Engineering &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Reverse Engineering the .IRG infrared thermal imaging format - help needed]]></title>
		<link>https://shkspr.mobi/blog/2023/02/reverse-engineering-the-irg-infrared-thermal-imaging-format-help-needed/</link>
					<comments>https://shkspr.mobi/blog/2023/02/reverse-engineering-the-irg-infrared-thermal-imaging-format-help-needed/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sat, 11 Feb 2023 12:34:48 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[infrared]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[thermal]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=44751</guid>

					<description><![CDATA[I always find it depressing when I reach the limits of my abilities.  I have a new Thermal Imaging camera. It automatically saves photos in two formats. The first is a standard JPEG with false colours and metadata superimposed.    The second is a .irg file which can only be opened by the Windows-only software which comes with the camera.  Judging from what that software shows, the .irg contains a …]]></description>
										<content:encoded><![CDATA[<p>I always find it depressing when I reach the limits of my abilities.</p>

<p>I have a <a href="https://shkspr.mobi/blog/2023/02/gadget-review-topdon-tc004-infrared-camera/">new Thermal Imaging camera</a>. It automatically saves photos in two formats. The first is a standard JPEG with false colours and metadata superimposed.</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2023/02/nose.jpg" alt="My smiling post. My nose is very cold." width="240" height="320" class="aligncenter size-full wp-image-44763">

<p>The second is a <code>.irg</code> file which can <em>only</em> be opened by the Windows-only software which comes with the camera.</p>

<p>Judging from what that software shows, the <code>.irg</code> contains a raw thermal image and separate metadata. That makes it more useful for analysis.</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2023/01/metadata.jpg" alt="Screenshot of the app. Alongside the thermal image, a bunch of metadata is shown." width="768" class="aligncenter size-full wp-image-44742">

<h2 id="what-i-know-not-much"><a href="https://shkspr.mobi/blog/2023/02/reverse-engineering-the-irg-infrared-thermal-imaging-format-help-needed/#what-i-know-not-much">What I know (not much!)</a></h2>

<p>Here's what I can find out about this undocumented file format.</p>

<p>Every <code>.irg</code> file is <em>exactly</em> 131,080 bytes.  I presume that means the image is stored as an uncompressed array of pixels - the thermal sensor is only 256x192. And I also guess that it has fixed length fields for metadata?</p>

<p>Each file has a different MD5 hash - so these are unique.</p>

<p>I couldn't identify the images with the standard Linux tools of <code>identify</code>, <code>strings</code>, <code>file</code>, or <code>exiftool</code>. Thermal Imaging tools like <a href="https://github.com/gtatters/ThermImageJ">ThermImageJ</a> weren't able to read them.</p>

<p>Running <code>binwalk</code> showed that there was a JPEG at <code>0x1FAC0</code> until the end of the file. Each <code>.irg</code> had exactly the same JPEG attached:</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2023/02/green.jpg" alt="A small green rectangle." width="180" height="240" class="aligncenter size-full wp-image-44854">

<p>An unexciting, 180x240, 1,352 byte, lump of green. There's no exif in it.</p>

<p>A <code>hexdump</code> shows that all the <code>.irg</code> files start with the same header:</p>

<pre><code class="language-_">0000000 0bb0 0080 a8c0 0000 00f0 00b4 c000 00a8
0000010 f000 b400 0000 a8c0 0000 00f0 00b4 251c
0000020 0000 7e7c 002d 7e7c 002d 1388 0000 0fa0
0000030 0000 2710 0000 0000 0000 2710 0000 0000
0000040 0000 0000 0000 0004 0000 0002 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
</code></pre>

<p>That doesn't look like any file signature I recognise.</p>

<p>The metadata on the software's PDF manual showed it was written by <a href="https://www.infiray.com/">Infiray</a>. They don't have any details on their site and haven't responded to my emails.</p>

<p>My knowledge of comparing hexdumps and trying to interpret them is lacking. It looks to me like there is a bunch of regular data in there, but I wasn't able to make head nor tale of it.</p>

<p>There are some <a href="https://irinfo.org/articles/04-01-2006-colbert">articles about decoding these sorts of files</a> but I wasn't able to apply that knowledge.</p>

<h2 id="your-turn"><a href="https://shkspr.mobi/blog/2023/02/reverse-engineering-the-irg-infrared-thermal-imaging-format-help-needed/#your-turn">Your turn</a></h2>

<p>Well gang, I'm stumped!  <a href="https://shkspr.mobi/blog/wp-content/uploads/2023/02/irg.zip">Here is a zip with 5 JPEGs and their corresponding 5 <code>.irg</code> files</a>.</p>

<p>If you can decipher how they work, or get me any closer to an open source viewer, please let me know!</p>

<h2 id="progress"><a href="https://shkspr.mobi/blog/2023/02/reverse-engineering-the-irg-infrared-thermal-imaging-format-help-needed/#progress"><ins datetime="2023-02-11T14:46:21+00:00">Progress</ins></a></h2>

<p>James has <a href="https://gist.github.com/jamesoff/9dab11cc377e4504e8dc87d1ab47c333">a quick scrap of Python to extract the black and white image</a>.</p>

<iframe src="https://mastodon.jamesoff.net/@jamesoff/109846605678971967/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width="400" height="800" allowfullscreen="allowfullscreen"></iframe>

<p>I <em>think</em> that's just from the visual sensor, rather than the thermal sensor - but it's a start!</p>

<p><ins datetime="2023-02-13T16:22:00+00:00">Further Update!</ins></p>

<p><a href="https://git.sr.ht/~phlash/irgdump">Phil has completely reverse engineered it</a>!</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=44751&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2023/02/reverse-engineering-the-irg-infrared-thermal-imaging-format-help-needed/feed/</wfw:commentRss>
			<slash:comments>12</slash:comments>
		
		
			</item>
	</channel>
</rss>
