Skip to content

Commit bac7ad1

Browse files
CopilotHexagon
andauthored
docs: fix format count, missing formats, TIFF description, and orphaned sentence
Agent-Logs-Url: https://github.com/cross-org/image/sessions/82db3afd-245a-4890-b8d3-71dca53c36f4 Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
1 parent 71e36f3 commit bac7ad1

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ const imageWithWarnings = await Image.decode(data, {
199199
```
200200

201201
**Note:** When using `Image.decode()`, the library automatically tries runtime-optimized decoders
202-
203-
## CMYK Color Space Support
202+
(ImageDecoder API) first, falling back to the pure JS decoder with tolerant mode for maximum
203+
compatibility.
204204

205205
The library provides utilities for working with CMYK (Cyan, Magenta, Yellow, Key/Black) color space,
206206
commonly used in professional printing and color manipulation.
@@ -378,9 +378,6 @@ const roundtrip = await Image.decode(parsed.bytes, "png");
378378
console.log(roundtrip.width, roundtrip.height);
379379
```
380380

381-
(ImageDecoder API) first, falling back to the pure JS decoder with tolerant mode for maximum
382-
compatibility.
383-
384381
## Fault-Tolerant Decoding for Other Formats
385382

386383
In addition to JPEG, @cross/image provides fault-tolerant decoding for several other formats that

docs/src/examples/decoding-encoding.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,51 @@ const pcx = await image.encode("pcx");
280280
await Deno.writeFile("output.pcx", pcx);
281281
```
282282

283+
### QOI (Quite OK Image)
284+
285+
Fast lossless format with simple encoding.
286+
287+
```ts
288+
import { Image } from "jsr:@cross/image";
289+
290+
const data = await Deno.readFile("input.png");
291+
const image = await Image.decode(data);
292+
293+
// Encode as QOI
294+
const qoi = await image.encode("qoi");
295+
await Deno.writeFile("output.qoi", qoi);
296+
```
297+
298+
### PGM (Portable GrayMap)
299+
300+
Netpbm grayscale format; RGB is converted to grayscale using luma weighting.
301+
302+
```ts
303+
import { Image } from "jsr:@cross/image";
304+
305+
const data = await Deno.readFile("input.png");
306+
const image = await Image.decode(data);
307+
308+
// Encode as PGM (binary P5 format)
309+
const pgm = await image.encode("pgm");
310+
await Deno.writeFile("output.pgm", pgm);
311+
```
312+
313+
### PBM (Portable BitMap)
314+
315+
Netpbm monochrome format; pixels at or above luma 128 become white.
316+
317+
```ts
318+
import { Image } from "jsr:@cross/image";
319+
320+
const data = await Deno.readFile("input.png");
321+
const image = await Image.decode(data);
322+
323+
// Encode as PBM (binary P4 format)
324+
const pbm = await image.encode("pbm");
325+
await Deno.writeFile("output.pbm", pbm);
326+
```
327+
283328
## Format Conversion Examples
284329

285330
### PNG to JPEG

docs/src/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,13 @@ await Image.decode(bytes, "png");
136136

137137
## Supported Formats
138138

139-
@cross/image supports 15 image formats with varying levels of pure-JS implementation:
139+
@cross/image supports 18 image formats with varying levels of pure-JS implementation:
140140

141-
- **PNG, APNG, BMP, ICO, GIF, DNG, PAM, PPM, PCX, ASCII** - Full pure-JS implementation
141+
- **PNG, APNG, BMP, ICO, GIF, DNG, PAM, PPM, PGM, PBM, PCX, QOI, ASCII** - Full pure-JS
142+
implementation
142143
- **JPEG** - Pure-JS baseline & progressive DCT
143144
- **WebP** - Pure-JS lossless, native API for lossy VP8
144-
- **TIFF** - Pure-JS uncompressed + LZW, native API for other compressions
145+
- **TIFF** - Pure-JS uncompressed, LZW, PackBits & Deflate; native API for JPEG compression
145146
- **HEIC, AVIF** - Runtime-based implementation (requires ImageDecoder/OffscreenCanvas API)
146147

147148
See the [Format Support](formats.md) page for detailed compatibility information.

0 commit comments

Comments
 (0)