Share to: share facebook share twitter share wa share telegram print page

QOI (image format)

Quite OK Image
Filename extension
.qoi
Magic numberqoif (4 bytes, ASCII)
Developed byDominic Szablewski
Initial release24 November 2021
Latest release
1.0
5 January 2022; 2 years ago (2022-01-05)
Type of formatLossless bitmap image format
StandardSpecification
Open format?Yes
Free format?Yes
Websiteqoiformat.org

The Quite OK Image Format (QOI) is a specification for lossless image compression of 24-bit (8 bits per color RGB) or 32-bit (8 bits per color with 8-bit alpha channel RGBA) color raster (bitmapped) images, invented by Dominic Szablewski and first announced on 24 November 2021.[1]

Description

The intended purpose was to create an open source lossless compression method that was faster and easier to implement than PNG. Figures specified in the blog post announcing the format claim twenty to fifty times faster encoding, and three to four times faster decoding speed compared to PNG, with similar file sizes.[1] The author has donated the specification to the public domain (CC0).[2]

Software and language support

QOI is supported natively by ImageMagick,[3] Imagine (v1.3.9+), IrfanView (v4.60+),[4] FFmpeg (v5.1+),[5] and GraphicConverter (v11.8+).[6] Microsoft PowerToys (v0.76+) for Windows 10 and 11 adds support for previewing QOI images to the Windows File Explorer.[7][8] Community made plugins are available in GIMP, Paint.NET and XnView MP.[9]

The game engine GameMaker designates bzip2 + QOI as the default format of texture groups since version 2022.1.0.609, to achieve the better compression but still quicker to decompress, while the standalone QOI and PNG formats are optional for the even faster performance and better compabilities respectively.[10][11]

There are also implementations for various languages such as Rust, Python, Java, C++, C# and more.[12] A full list can be found on the project's Git(Hub) repository README.

File format

Header

A QOI file consists of a 14-byte header, followed by any number of data “chunks” and an 8-byte end marker.

qoi_header {
    char magic[4]; // magic bytes "qoif"
    uint32_t width; // image width in pixels (BE)
    uint32_t height; // image height in pixels (BE)
    uint8_t channels; // 3 = RGB, 4 = RGBA
    uint8_t colorspace; // 0 = sRGB with linear alpha
// 1 = all channels linear
};

The colorspace and channel fields are purely informative. They do not change the way data chunks are encoded.

Encoding

Images are encoded row by row, left to right, top to bottom. The decoder and encoder start with {r: 0, g: 0, b: 0, a: 255} as the previous pixel value. An image is complete when all pixels specified by width * height have been covered. Pixels are encoded as:

  • Run-length encoding of the previous pixel (QOI_OP_RUN)
  • an index into the array of previously seen pixels (QOI_OP_INDEX)
  • a difference compared to the previous pixel value in r,g,b (QOI_OP_DIFF or QOI_OP_LUMA)
  • Full r,g,b or r,g,b,a values (QOI_OP_RGB or QOI_OP_RGBA)

The color channels are assumed to not be premultiplied with the alpha channel (“un-premultiplied alpha”). A running array[64] (zero-initialized) of previously seen pixel values is maintained by the encoder and decoder. Each pixel that is seen by the encoder and decoder is put into this array at the position formed by a hash function of the color value.

In the encoder, if the pixel value at the index matches the current pixel, this index position is written to the stream as QOI_OP_INDEX. The hash function for the index is:

index_position = (r * 3 + g * 5 + b * 7 + a * 11) % 64

Each chunk starts with a 2- or 8-bit tag, followed by a number of data bits. The bit length of chunks is divisible by 8 - i.e. all chunks are byte aligned. All values encoded in these data bits have the most significant bit on the left. The 8-bit tags have precedence over the 2-bit tags. A decoder must check for the presence of an 8-bit tag first. The byte stream's end is marked with 7 0x00 bytes followed by a single 0x01 byte.

The possible chunks are:

QOI_OP_RGB

Byte[0] Byte[1] Byte[2] Byte[3]
7 6 5 4 3 2 1 0 7 .. 0 7 .. 0 7 .. 0
1 1 1 1 1 1 1 0 red green blue
  • 8-bit tag b11111110 (254)
  • 8-bit red channel value
  • 8-bit green channel value
  • 8-bit blue channel value

The alpha value remains unchanged from the previous pixel.

QOI_OP_RGBA

Byte[0] Byte[1] Byte[2] Byte[3] Byte[4]
7 6 5 4 3 2 1 0 7 .. 0 7 .. 0 7 .. 0 7 .. 0
1 1 1 1 1 1 1 1 red green blue alpha
  • 8-bit tag b11111111 (255)
  • 8-bit red channel value
  • 8-bit green channel value
  • 8-bit blue channel value
  • 8-bit alpha channel value

QOI_OP_INDEX

Byte[0] (Range: 0 .. 63)
7 6 5 4 3 2 1 0
0 0 index
  • 2-bit tag b00
  • 6-bit index into the color index array: 0..63

A valid encoder must not issue 2 or more consecutive QOI_OP_INDEX chunks to the same index. QOI_OP_RUN should be used instead.

QOI_OP_DIFF

Byte[0] (Range: 64 .. 127)
7 6 5 4 3 2 1 0
0 1 dr dg db
  • 2-bit tag b01
  • 2-bit red channel difference from the previous pixel -2..1
  • 2-bit green channel difference from the previous pixel -2..1
  • 2-bit blue channel difference from the previous pixel -2..1

The difference to the current channel values are using a wraparound operation, so 1 - 2 will result in 255, while 255 + 1 will result in 0.

Values are stored as unsigned integers with a bias of 2. E.g. −2 is stored as 0 (b00). 1 is stored as 3 (b11). The alpha value remains unchanged from the previous pixel.

QOI_OP_LUMA

Byte[0] (Range: 128 .. 191) Byte[1]
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
1 0 dg dr - dg db - dg
  • 2-bit tag b10
  • 6-bit green channel difference from the previous pixel -32..31
  • 4-bit red channel difference minus green channel difference -8..7
  • 4-bit blue channel difference minus green channel difference -8..7

The green channel is used to indicate the general direction of change and is encoded in 6 bits. The red and blue channels (dr and db) base their diffs off of the green channel difference. I.e.:

dr_dg = (cur_px.r - prev_px.r) - (cur_px.g - prev_px.g)
db_dg = (cur_px.b - prev_px.b) - (cur_px.g - prev_px.g)

The difference to the current channel values are using a wraparound operation, so 10 - 13 will result in 253, while 250 + 7 will result in 1.

Values are stored as unsigned integers with a bias of 32 for the green channel and a bias of 8 for the red and blue channel. The alpha value remains unchanged from the previous pixel.

QOI_OP_RUN

Byte[0] (Range: 192 .. 253)
7 6 5 4 3 2 1 0
1 1 run
  • 2-bit tag b11
  • 6-bit run-length repeating the previous pixel

The run-length is stored with a bias of −1. Note that the runlengths 63 and 64 (b111110 and b111111) are illegal as they are occupied by the QOI_OP_RGB and QOI_OP_RGBA tags.[13]

References

  1. ^ a b "Lossless Image Compression in O(n) Time". Phoboslab.org. 2021-11-24. Archived from the original on 2022-05-08. Retrieved May 1, 2022.
  2. ^ "QOI The Quite OK Image Format". qoiformat.org. 2023-12-14. Archived from the original on 2023-12-16. Retrieved December 14, 2023.
  3. ^ "ImageMagick - Image Formats". Archived from the original on January 2, 2022. Retrieved May 4, 2022.
  4. ^ "History of IrfanView Changes/Versions". www.irfanview.com. Archived from the original on 2021-01-14. Retrieved 2022-05-10.
  5. ^ "FFmpeg Changelog - Gitweb". ffmpeg.org. Archived from the original on 2022-07-13. Retrieved 2022-07-13.
  6. ^ "GraphicConverter Release Notes version 11.8 (build 5762)". Lemke Software. Archived from the original on 11 February 2023. Retrieved 21 February 2023.
  7. ^ "Release v0.76.0". Microsoft. Retrieved 26 March 2024.
  8. ^ "PowerToys File Explorer add-ons utility for Windows". learn.microsoft.com. 2023-12-04. Retrieved 2024-02-05.
  9. ^ James Hein. "Moving images to the next level". Bangkok Post. Retrieved April 1, 2022.
  10. ^ "Version 2022.1.0.609". GameMaker Release Notes. YoYo Games. 26 January 2022. Retrieved 26 March 2024.
  11. ^ "Texture Groups". GameMaker Manual. YoYo Games. Retrieved 26 March 2024.
  12. ^ Simon Sharwood. "Developer creates 'Quite OK Image Format' – but it performs better than just OK". The Register. Archived from the original on 2023-06-02. Retrieved 2023-12-30.
  13. ^ Szablewski, Dominic (2022-01-05). "The Quite OK Image Format Specification" (PDF). Archived (PDF) from the original on 2022-04-30. Retrieved 2022-06-05. Public Domain This article incorporates text from this source, which is in the public domain.

External links

Read more information:

Chinese Democracy TourTur World oleh Guns N' RosesLokasiAmerika, Eropa, Oseania, AsiaChinese DemocracyMulai1 Januari 2001Berakhir31 Desember 2011Putaran19Penampilan2001: 4 (17 batal)2002: 23 (19 cancelled)2003: 0 (2 cancelled)2004: 0 (1 cancelled)2006: 75 (7 cancelled)2007: 20 (2 cancelled)2009: 42010: 72 (2 cancelled)2011: 41 (3 batal)Total shows: 239Kronologi konser Guns N' Roses Use Your Illusion Tour(1991-93) Chinese Democracy Tour(2001-02; 2006-07; 2009-11) Up Close and Personal Tour(2012) …

Bélâbre Entidad subnacional Escudo BélâbreLocalización de Bélâbre en Francia Coordenadas 46°33′05″N 1°09′29″E / 46.551388888889, 1.1580555555556Entidad Comuna de Francia • País  Francia • Región Centro • Departamento Indre • Distrito distrito de Le Blanc • Cantón cantón de Bélâbre (chef-lieu) • Mancomunidad Communauté de communes du Val d'AnglinAlcalde René Duplant(2001-2008)Superficie   • Total 4…

Нойлаа Транспортна мережа Віденський метрополітен Країна  Австрія Адміністративна одиниця Фаворитен Дата офіційного відкриття 2 вересня 2017 Сусідня станція Алауда-гассе і Оберлаа Обслуговується маршрутом Лінія U1 Віденського метрополітенуd Залізнична лінія Лінія…

Yoshitaro Nomura in 1955 Yoshitaro Nomura (野村 芳太郎, Nomura Yoshitarō; Asakusa, 23 april 1919 - Shinjuku, 8 april 2005) was een Japans filmregisseur. Nomura werd geboren te Asakusa (Tokio), als zoon van Hotei Nomura. Zijn vader was directeur van een Japanse filmstudio. Nomura studeerde aan de Keio-universiteit, en begon zijn carrière in 1941 op 22-jarige leeftijd. Hij moest echter al snel in dienst. Vanaf 1946 werkte hij als hij regie-assistent. In 1951 was hij assistent van Akira Kuro…

Diving at the 2019 Southeast Asian GamesVenueNew Clark City Aquatics Center, CapasDates6–7 DecemberCompetitors24 from 6 nations← 20172021 → Diving at the2019 SEA GamesIndividual1 m Springboardmenwomen3 m Springboardmenwomen10 m platformmenwomenSynchronised3 m Springboardmenwomen10 m platformmenwomenMixedMixed3 m10 mTeamvte Main article: Diving at the 2019 Southeast Asian Games The diving competitions at the 2019 Southeast Asian Games in Philippines too…

Piotr Apostoł jest według tradycji najdłużej panującym papieżem. Pius IX – papież o najdłuższym możliwym do zweryfikowania panowaniu. Stefan II był papieżem, który zmarł przed święceniami biskupimi wymaganymi do właściwego objęcia tronu. Czyni to go najkrócej panującym, ale też z tego powodu często nie jest liczony. Panowanie papieża Urbana VII jest najkrótszym oficjalnie uznanym pontyfikatem. Pontyfikat – okres sprawowania władzy w Kościele katolickim przez papie

Inhaltsverzeichnis 1 Christentum 1.1 St. Albert 1.2 Apostelkirche 1.3 Auferstehungskirche 1.4 St. Bonifaz 1.5 Christ König 1.6 Christuskirche 1.7 Comeniuskirche 1.8 St. Cyriakus 1.9 St. Dreifaltigkeit 1.10 Erlöserkirche 1.11 Hl. Familie 1.12 Friedenskirche 1.13 St. Gallus 1.14 Hl. Geist 1.15 St. Hedwig 1.16 Herz Jesu 1.17 St. Hildegard 1.18 Jakobuskirche 1.19 Johanneskirche 1.20 St. Josef 1.21 St. Joseph 1.22 Hl. Kreuz 1.23 St. Ludwig 1.24 Lukaskirche 1.25 Lutherkirche 1.26 St. Marien 1.27 Mar…

يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. (يوليو 2019) منتخب بورتوريكو لكرة اليد البلد ؟؟ الزي الأساسي الزي الإحتياطي بطولة بان أميركان لكرة اليد الظهور 7 (أول مرة…

  هذه المقالة عن جورج الأول ملك اليونان. لعناوين مشابهة، طالع جورج الأول. لهنا، طالع جورج الأول ملك اليونان (توضيح). جورج الأول ملك اليونان (بالدنماركية: Georg I.)‏  معلومات شخصية الميلاد 24 ديسمبر 1845(1845-12-24)كوبنهاغن الوفاة 18 مارس 1913 (67 سنة)سالونيك سبب الوفاة إصابة بعيار ناري…

Sporting event delegationLithuania at the2008 Summer ParalympicsIPC codeLTUNPCLithuanian Paralympic CommitteeWebsitewww.lpok.ltin BeijingCompetitors27 in 5 sportsMedalsRanked 56th Gold 0 Silver 2 Bronze 0 Total 2 Summer Paralympics appearances (overview)199219962000200420082012201620202024Other related appearances Soviet Union (1988) Lithuania competed at the 2008 Summer Paralympics in Beijing, China.[1] Medalists Medal Name Sport Event  Silver Aldona Grigaliuniene Athletics Wo…

Artikel ini sebatang kara, artinya tidak ada artikel lain yang memiliki pranala balik ke halaman ini.Bantulah menambah pranala ke artikel ini dari artikel yang berhubungan atau coba peralatan pencari pranala.Tag ini diberikan pada September 2016. Naomi SusanLahirNaomi Susan(1975-01-15)15 Januari 1975Medan, IndonesiaKebangsaanIndonesiaPekerjaanPengusahaSuami/istridr. Yusfa Rasyid, SpoGOrang tuaEndang S Sukandar (alm) dan SuyentiSitus webhttp://www.naomi-susan.com Naomi Susan (lahir 15 Januari 197…

American actor (born 1943) For his father, the painter, see Robert De Niro Sr. De Niro redirects here. For other people with this surname, see De Niro (surname). Robert De NiroDe Niro in 2016BornRobert Anthony De Niro (1943-08-17) August 17, 1943 (age 80)New York City, U.S.Occupations Actor film producer film director Years active1963–presentWorksFull listScorsese collabsSpouses Diahnne Abbott ​ ​(m. 1976; div. 1988)​ Grace Hightower &#…

Indian politician Not to be confused with Abdus Sattar (president). For disambiguation, see Abdus Sattar. Abdus Sattar is a politician in West Bengal, India, belonging to the Indian National Congress. He was a former Communist Party of India (Marxist) Politician. After the 2006 West Bengal state assembly election (in which he was elected MLA from the Amdanga constituency) he became Minister of State for Minorities Development, Welfare and Madrasah Education in the Left Front Ministry.[1]…

Sultan of Ghaznavid dynasty (r. 1030–1030) (1040–1041) Muhammad bin MahmudGold dinar minted in Ghazna dated 419 AH (1028/9 CE).Sultan of Ghaznavid Empire1st Reign1030 – 1030PredecessorMahmud of GhazniSuccessorMas'ud I of Ghazni2nd Reign1040 – 1041[1]PredecessorMas'ud I of GhazniSuccessorMawdud of GhazniBornc. 998Ghazni Ghaznavid Empire (now in Afghanistan)Diedc. 1041 (aged 42–43)Ghazni Ghaznavid EmpireBurialc. 1041GhazniConsortDaughter of Abu'l-Nasr MuhammadIs…

Orden vom Weißen Adler Bandschnalle Ordenskreuz des Weißen Adlers in Schloss Pillnitz Der Orden des Weißen Adlers (polnisch Order Orła Białego) ist das höchste Ehrenzeichen der Dritten Republik Polen und war die höchste Auszeichnung der Ersten Republik Polen, des Herzogtums Warschau, Kongresspolens (bis 1831) und der Zweiten Republik Polen (1918–1945). Der Orden wurde 1705 von dem in Bedrängnis geratenen König August dem Starken nach dem Vorbild des Schwarzen Adlerordens gestiftet. Vo…

Autodromo Internacional José TobarCurrent Circuit (Clockwise) Original Circuit (Anti-clockwise)LocationIbarra, EcuadorTime zoneGMT -5Coordinates0°22′48″N 78°5′48″W / 0.38000°N 78.09667°W / 0.38000; -78.09667Broke ground16 May 1963; 60 years ago (1963-05-16)Opened2 May 1970; 53 years ago (1970-05-02)Former namesAutodromo Internacional de YahuarcochaCurrent Circuit (1983–present)Length3.650 km (2.268 miles)Turns16Original C…

River in RussiaSharzhengaRussian: ШарженгаBridge over Sharzhenga in Logduz, Vologda OblastLocationCountryRussiaPhysical characteristicsMouthYug • coordinates59°46′35″N 45°23′53″E / 59.77639°N 45.39806°E / 59.77639; 45.39806 • elevation107 metres (351 ft)Length183 km (114 mi)[1]Basin size1,500 square kilometres (580 sq mi)[1]Discharge  • average14 cubic me…

English feudal barony founded in 1205 Moated site of Eaton Castle, drawn in 1911. Situated about 800 metres west of the village of Eaton Bray, now open to the public for fishing, operated by Park Farm Fisheries[1] Map of Normandy showing possible locations of origin for the English de Cantilupe family, feudal barons of Eaton Bray and Barons Cantilupe (1299) Château de Chanteloup, Bréhal, Manche, stated in several sources[2] to be the most likely origin of the English de Cantilu…

Endurance sports car event Suzuka 1000kmSuzuka 10 HoursSuper GTVenueSuzuka International Racing CourseFirst race1966Last race2019Laps78Duration1000 kilometres (1966-1973, 1980-2008, 2012-2017)700 kilometres (2009-2010)500 kilometres (2011)10 hours (2018-2019)Most wins (driver)Kunimitsu Takahashi (4)Most wins (manufacturer)Porsche (11) The Suzuka Summer Endurance Race is an annual sports car endurance race that was last held at the Suzuka International Racing Course, Mie Prefecture, Japan in 2019…

2023 single by 2 Chainz and Lil Wayne PreshaSingle by 2 Chainz and Lil Waynefrom the album Welcome 2 Collegrove ReleasedOctober 20, 2023GenreTrapLength3:05LabelGamebreadDef JamSongwriter(s)Tauheed EppsDwayne Carter Jr.Shondrae CrawfordMike ElizondoCurtis Jackson IIIAndre YoungProducer(s)Bangladesh2 Chainz singles chronology Room (2023) Presha (2023) Long Story Short (2023) Lil Wayne singles chronology Brand New(2023) Presha(2023) Big Dog(2023) Presha is a song by American rappers 2 Chain…

Kembali kehalaman sebelumnya