-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ec8f04
commit 568dc2d
Showing
17 changed files
with
71 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
coverage/ | ||
.coverage/ | ||
.output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,26 @@ | ||
# qoi | ||
# Img | ||
|
||
This is a TypeScript implementation of the QOI image format. The module offers | ||
both sync and streaming versions to encode and decode to and from the QOI image | ||
format. The raw pixel format/ the decoded format is a repeating sequence of | ||
`[ r, g, b, a ]` in a `Uint8Array`, `Uint8ClampedArray`, or a | ||
`ReadableStream<Uint8Array>`. | ||
Img is a repo containing implemenetations, made from scratch, of various image | ||
formats offering the ability to encode and decode between them, and integrate | ||
smoothly with various Web APIs like the Canvas. Where possible, we offer both | ||
sync and streaming encoders/decoders. | ||
|
||
This implementationis based off the | ||
[QOI Specification](https://qoiformat.org/qoi-specification.pdf). You can find | ||
about more about QOI at their website: https://qoiformat.org/. | ||
## Missing a format? | ||
|
||
## Example | ||
If this repo is missing a format you'd like to work with, simply create an issue | ||
suggesting the format, along with a link to the standard, specifcation or some | ||
document that is essentally the source of truth for that format. Do that and it | ||
might get an implementation here. | ||
|
||
```ts | ||
import { encodeQOI } from "@img/qoi"; | ||
## Formats | ||
|
||
const rawData = await new Response(ReadableStream.from(async function* () { | ||
for (let r = 0; r < 256; ++r) { | ||
for (let c = 0; c < 256; ++c) { | ||
yield Uint8Array.from([255 - r, c, r, 255]); | ||
} | ||
} | ||
}())).bytes(); | ||
|
||
await Deno.writeFile( | ||
"image.qoi", | ||
encodeQOI(rawData, { | ||
width: 256, | ||
height: 256, | ||
channels: "rgb", | ||
colorspace: 0, | ||
}), | ||
); | ||
``` | ||
| Package | Latest Version | Spec | | ||
| ------------------------------------- | -------------------------------------- | ------------------------------------------------------------ | | ||
| [@img/apng](https://jsr.io/@img/apng) | Not Implemented Yet | https://wiki.mozilla.org/APNG_Specification | | ||
| [@img/avif](https://jsr.io/@img/avif) | Not Implemented Yet | https://aomediacodec.github.io/av1-avif/v1.1.0.html | | ||
| [@img/gif](https://jsr.io/@img/gif) | Not Implemented Yet | https://www.w3.org/Graphics/GIF/spec-gif89a.txt | | ||
| [@img/jpeg](https://jsr.io/@img/jpeg) | Not Implemented Yet | https://www.w3.org/Graphics/JPEG/jfif3.pdf | | ||
| [@img/png](https://jsr.io/@img/png) | Not Implemented Yet | https://www.w3.org/TR/2003/REC-PNG-20031110/ | | ||
| [@img/qoi](https://jsr.io/@img/qoi) | ![JSR](https://jsr.io/badges/@img/qoi) | https://qoiformat.org/qoi-specification.pdf | | ||
| [@img/avg](https://jsr.io/@img/svg) | Not Implemented Yet | https://www.w3.org/TR/SVG2/ | | ||
| [@img/webp](https://jsr.io/@img/webp) | Not Implemented Yet | https://developers.google.com/speed/webp/docs/riff_container | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "@img/qoi", | ||
"version": "0.1.3", | ||
"exports": { | ||
".": "./mod.ts", | ||
"./decode": "./decode.ts", | ||
"./decoder-stream": "./decoder_stream.ts", | ||
"./encode": "./encode.ts", | ||
"./encoder-stream": "./encoder_stream.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.