Skip to content

Instantly share code, notes, and snippets.

@nicolaslegland
Last active April 24, 2024 09:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolaslegland/f0577cb49b1e56b729a2c0fc0aa151ba to your computer and use it in GitHub Desktop.
Save nicolaslegland/f0577cb49b1e56b729a2c0fc0aa151ba to your computer and use it in GitHub Desktop.
QOI decoder
<html>
<head>
<base href="https://gist.githubusercontent.com/nicolaslegland/f0577cb49b1e56b729a2c0fc0aa151ba/raw/" />
<title>QOI decoder</title>
<style>
a, img, li, ul
{
margin: 0;
padding: 0;
}
img
{
border: 1px solid #bbb;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEXu7u7///8o06qaAAAAFklEQVQI12Ng+P+fgYEIAoyoSBBpLwDtvT/B5CO+hgAAAABJRU5ErkJggg==);
margin: 8px 8px 8px 8px;
}
ul
{
list-style-type: none;
}
</style>
</head>
<body>
<h1>QOI decoder in browser</h1>
<h2>Usage</h2>
<pre>
&lt;img&nbsp;src="<a href="qoi_logo.qoi">qoi_logo.qoi</a>" /&gt;<br />
&lt;img&nbsp;src="<a href="testcard.qoi">testcard.qoi</a>" /&gt;&lt;img&nbsp;src="<a href="testcard_rgba.qoi">testcard_rgba.qoi</a>" /&gt;<br />
&lt;img&nbsp;src="<a href="dice.qoi">dice.qoi</a>" /&gt;<br />
&lt;img&nbsp;src="<a href="kodim10.qoi">kodim10.qoi</a>" /&gt;&lt;img&nbsp;src="<a href="kodim23.qoi">kodim23.qoi</a>" /&gt;<br />
&lt;img&nbsp;src="<a href="wikipedia_008.qoi">wikipedia_008.qoi</a>" /&gt;<br />
&lt;img&nbsp;src="<a href="edgecase.qoi">edgecase.qoi</a>" /&gt;<br />
...<br />
&lt;script src="<a href="qoi.js">qoi.js</a>"&gt;&lt;/script&gt;
</pre>
<h2>Reference</h2>
<p>Preview:&nbsp;<a href="https://gistpreview.github.io/?f0577cb49b1e56b729a2c0fc0aa151ba">https://gistpreview.github.io/?f0577cb49b1e56b729a2c0fc0aa151ba</a></p>
<p>Source:&nbsp;<a href="https://gist.github.com/nicolaslegland/f0577cb49b1e56b729a2c0fc0aa151ba">https://gist.github.com/nicolaslegland/f0577cb49b1e56b729a2c0fc0aa151ba</a></p>
<p>Specification:&nbsp;<a href="https://qoiformat.org/qoi-specification.pdf">https://qoiformat.org/qoi-specification.pdf</a></p>
<h2>Result</h2>
<ul>
<li><a href="qoi_logo.qoi"><img src="qoi_logo.qoi" /></a></li>
<li><a href="testcard.qoi"><img src="testcard.qoi" /></a><a href="testcard_rgba.qoi"><img src="testcard_rgba.qoi" /></a></li>
<li><a href="dice.qoi"><img src="dice.qoi" /></a></li>
<li><a href="kodim10.qoi"><img src="kodim10.qoi" /></a><a href="kodim23.qoi"><img src="kodim23.qoi" /></a></li>
<li><a href="wikipedia_008.qoi"><img src="wikipedia_008.qoi" /></a></li>
<li><a href="edgecase.qoi"><img src="edgecase.qoi" /></a></li>
</ul>
<script>
var request = new XMLHttpRequest();
request.onreadystatechange = function ()
{
if ((200 === this.status) && (4 === this.readyState))
{
eval(this.response);
}
};
request.open('GET', 'qoi.js', true);
request.send();
</script>
</body>
</html>
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<title>QOI decoder</title>
<script><!--
//<![CDATA[
document.location.href = 'https://gistpreview.github.io/?f0577cb49b1e56b729a2c0fc0aa151ba';
//]]>
//--></script>
</head>
<body>
<h1>QOI decoder</h1>
<a href="https://gistpreview.github.io/?f0577cb49b1e56b729a2c0fc0aa151ba">https://gistpreview.github.io/?f0577cb49b1e56b729a2c0fc0aa151ba</a>
</body>
</html>
This file has been truncated, but you can view the full file.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment