News: 1640067313

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Developer creates ‘Quite OK Image Format’ – but it performs better than just OK

(2021/12/21)


A developer named Dominic Szablewski has given the world a new file format with a splendid name: the Quite OK Image Format (QOI).

The file format might be better than that. Szablewski [1]explained that he decided the world needed a new image format because the likes of PNG, JPEG, MPEG, MOV and MP4 “burst with complexity at the seams.”

“Every tiny aspect screams ‘design by consortium’,” he added, going on to lament the fact that most common codecs are old, closed, and “require huge libraries, are compute hungry and difficult to work with.”

[2]

Szablewski thought he could do better and appears to have achieved that objective by cooking up some code, floating it [3]on GitHub , and paying attention to the 500-plus comments it generated.

[4]

[5]

While Szablewski admits that QOI will not compress images as well as an optimized PNG encoder, he claims “losslessy compresses images to a similar size of PNG, while offering 20x-50x faster encoding and 3x-4x faster decoding.”

Most importantly, to Szablewski, the reference en-/decoder fits in about 300 lines of C and the file format spec requires is just one page long.

[6]It started at Pixar. Now it's the Apple-backed 3D file format viewed as HTML of metaverse

[7]Google's new squeeze: Brotli compression open-sourced

[8]We can't avoid it any longer. Here's a story about the NFT mania... aka someone bought a JPEG for $69m in Ether

“In the last few weeks QOI implementations for lot of different languages and libraries popped up,” Szablewski wrote on his blog, with Zig, Rust, Rust, Rust, Go, TypeScript, Haskell, Ć, Python, C#, Elixir, Swift, Java, and Pascal among the options.

“There is a native application to view .QOI files, plugins for Gimp, Paint.NET and XnView MP, support in SDL_Image (pending) and many more,” he added.

[9]

“With all this going on, it looks like QOI might actually end up being a thing ,” he wrote. “I don't expect it to appear in web browsers, where compression ratio is much more important, anytime soon. But there are use-cases in games or other applications where the performance benefits certainly make sense.”

You can check out the QOI yourself at [10]qoiformat.org . ®

Get our [11]Tech Resources



[1] https://phoboslab.org/log/2021/11/qoi-fast-lossless-image-compression

[2] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2YcGz5ZpfRHZvFfEfVrX0hQAAARE&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0

[3] https://github.com/phoboslab/qoi

[4] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44YcGz5ZpfRHZvFfEfVrX0hQAAARE&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[5] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33YcGz5ZpfRHZvFfEfVrX0hQAAARE&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[6] https://www.theregister.com/2021/11/10/usd_3d_format/

[7] https://www.theregister.com/2015/09/23/googles_brotli_compression_opensourced/

[8] https://www.theregister.com/2021/03/12/beeple_nft_sold/

[9] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44YcGz5ZpfRHZvFfEfVrX0hQAAARE&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[10] https://qoiformat.org/

[11] https://whitepapers.theregister.com/



Colour me impressed...

Neil Barnes

I've been contemplating image compression off and on for years, without doing anything really practical about it, and agree entirely with his comments about existing methods. I'm fed up of seeing jpeg compression artefacts on images; I shall have to play with this and see what happens.

I'm all in favour of simple file formats even at the cost of lower compression ratios... have one of these on me -->

Re: Colour me impressed...

Steve K

If as MacroRodent mentions below it's an 8-bit spec then you'll see colour artifacts due to compression?

Re: Colour me impressed...

Neil Barnes

You'd likely see quantising noise where a ten-or-more bit per colour channel is reduced to eight-bit RGB(A), but as it looks like it only accepts eight bit input depths then you'd need to preprocess higher bit depth images before compression, which would give you the option to choose the distortion of your choice: bit slicing, dither, smearing, whatever.

On the other hand, it doesn't look too complex to increase the pixel depth to 16 bits instead of 8, with a cost of an extra bit in the header to indicate depth, and a compressed image potentially twice the size... as always, the more depth in the image, the less chance of two identical adjacent bits. Perhaps you'd need a bigger indexed map?

(just thinking out loud here).

Re: Colour me impressed...

Hubert Cumberdale

Amen: I frickin' hate JPEG artefacts.* People need to be taught about this stuff: never use JPEG for graphs, text, or anything with hard lines ( especially company logos on websites... you spent all that money paying the graphic designer/ad agency/consultant, but then went and turned it into a 5kB JPEG? Seriously.). In these cases, go for PNG or similar (TIFF if you need precise colour management, SVG if you can). And reserve GIF for cats.

*Although I have to say, I hate WebP artefacts too, but in a different way: excessive compression with WebP can really make photos look weird (see, for example, most of the images on The Guardian). Just because something is apparently good quality on some metric or other, that doesn't mean it actually looks good.

Re: Colour me impressed...

Fruit and Nutcase

And reserve GIF for cats.

My Cat Overlord has expressed his displeasure at that statement --> icon

"We are not amused".

Pronouncing...

MatthewSt

Kwah? Koi? Queue oh eye?

It's gif/jif all over again!

Re: Pronouncing...

Anonymous Coward

I vote for "kawaii"

Re: Pronouncing...

Rob Daglish

So do I, their Pianos really are quite lovely to play, although I'm not sure how that suits them for government. Err...

Re: Pronouncing...

toby mills

Surely like the French quoi, what or why?

Re: Pronouncing...

jmch

Following French for anything related to pronunciation is sure to lead to trouble...

Re: Pronouncing...

AndrueC

Beware of geeks bearing GIFs.

Re: Pronouncing...

Steve K

What's a "jeek"?

Re: Pronouncing...

Graham Cunningham

Stop carping about the pronunciation. It's clearly "koi"...

Re: Pronouncing...

Chris G

A koi fish would also make a good logo.

Re: Pronouncing...

Anonymous Coward

I'd go for "coo-ee" myself.

Of course, it's an alternative to .png or .bmp. The article doesn't say, but I assume it's an RGB format rather than CMYK (or L*AB), and it might even be HDR. The world seems to be happy enough with alphabet-soup-style names so I don't think that it would be held back even if everyone settles on "queue-oh-eye".

Re: Pronouncing...

LionelB

I'd go for the (Ubuntu-friendly) Zulu "q", an [1]alveolar click .

[1] https://youtu.be/WHHGOYu6Fl0?t=125

Re: Pronouncing...

Piro

koi would be fine. Maybe it can get a metadata extension called carp

Re: Pronouncing...

Piro

Qoi Qarp :)

Re: Pronouncing...

Noodle

Quoif surely?

A Non e-mouse

I've just read his [1]blog post where he describes the image format and it is *very* simple. (So simple even I can understand it!)

Somestimes, simple is best.

[1] https://phoboslab.org/log/2021/11/qoi-fast-lossless-image-compression

AndrueC

I've dabbled with compression over the years and for the most part it's all quite simple. LZW is a bit mind bending in the way it regenerates the dictionary as it decompresses though and I vaguely recall there's one that uses floating point numbers in a really odd way.

My favourite has always been Huffman because that's the first I ever played with although I also have a soft spot for NTFS compression both the way it handles the bit stream (speed over efficiency) and the way it encodes the cluster allocation.

jonathan keith

I havent'. Is it middle-out compression?

Zig, Rust, Rust, Rust, Go, TypeScript, Haskell, Ć, Python, C#, Elixir, Swift, Java, and Pascal

Anonymous Coward

I didn't get the joke here: 3x Rust, C with a diacritic?

"C with a diacritic?"

LDS

It's C with the Hungarian notation....

Re: Zig, Rust, Rust, Rust, Go, TypeScript, Haskell, Ć, Python, C#, Elixir, Swift, Java, and Pascal

Antonius_Prime

I wonder will someone port it to Rust, though?

Re: Zig, Rust, Rust, Rust, Go, TypeScript, Haskell, Ć, Python, C#, Elixir, Swift, Java, and Pascal

Andy Miller

According to the docs on Github "Ć is a programming language which can be translated automatically to C, C++, C#, Java, JavaScript, Python, Swift, TypeScript and OpenCL C."

A new one on me, but then I'm very old....

Incredible

Pascal Monett

300 lines of C.

So there are still people who can write efficient code that doesn't use up 150MB of RAM just to load.

Count my gast flabbered.

Re: Incredible

Steve K

How long are the lines though......?

Quite OK

Phil O'Sophical

Would that be the US sense of "quite" or the UK one?

8-bit

MacroRodent

Glanced at the spec. It looks like each colour component is 8-bits only. I think in this day and age there should be an option for a greater colour depth. I can understand he wanted to keep this simple, but sticking to 8 bits prevents using it in some applications. For example, a very simple format like this would be perfect for long-term archiving (no problem including the format spec and decoder source with each volume of images!), but there could really use a greater bit depth.

Re: 8-bit

veti

If that's 8 bits in all, then - congratulations, he's reinvented GIF.

If it's 8 bits per channel, that's 24 bits of actual colour depth, which is respectable IMO.

Re: 8-bit

Hubert Cumberdale

As someone whose colour vision is rather skewiff, I don't think I can really tell the difference between 16-bit and 24-bit colour. I actually question whether normies can tell the difference between 24-bit and 32-bit colour too,* but then I guess something something dynamic range alpha channel etc.

*10 million colours [1]is apparently oft quoted , so I guess 16.7 million should be enough?

[1] https://doi.org/10.1002/(SICI)1520-6378(199802)23:1%3C52::AID-COL8%3E3.0.CO;2-2

Re: 8-bit

LDS

JPEG too is still stuck at 8 bits - but you're right, most images today have a far larger gamut than 24 bits allow.

Anyway this should be tested with a large sample of images - the one in its site is a computer-generated one, for example, and that has a different pixel distribution than a photo, where there could far more subtler changes among pixels.

Moreover today file formats and image compression algorithms are two separate entities. Many image file formats are actually containers that beyond the image data themselves (and sometimes more than one) need to host other data like image metadata, color profiles, etc.

Re: 8-bit

boblongii

More than 8-bits per channel is really only useful for intermediate formats used during editing to prevent rounding errors accumulating noticeably. It's not very useful for normal colour output. Greyscale, on the other hand, needs more. The encoding given seems like it would be easy to add 24bit greyscale, which is overkill, by using 11111100 and 111111011 (for +alpha) as 8bit flags.

Re: 8-bit

Anonymous Coward

We could always create new versions able to use 10, 12, 16, 17 bits...

--> https://xkcd.com/927/

Quite OK Image Format

Andy Non

Expected it to be QUIF

Excellent

Richard Tobin

The C code is readable and readily understandable in a single pass.

devin3782

But what is it's mime type, I'm hoping for image/ok

No, it could be useful for the web

Piro

PNG is widely used, and mobile devices with battery life concerns are an extremely common way to get online these days. Something that lightens the burden when processing images is welcome.

Very nice work, I've been having a gander at the benchmarks.

Re: No, it could be useful for the web

Korev

So you're saying it'd be something to write home about?

Superstition, idolatry, and hypocrisy have ample wages, but truth goes
a-begging.
-- Martin Luther