Skip to content

Commit

Permalink
add jxl, nix hiec
Browse files Browse the repository at this point in the history
  • Loading branch information
moorejs committed Nov 1, 2023
1 parent befee19 commit d57c5d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions docs/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ The effect of effort varies per format, but a lower value leads to faster encodi
The supported ranges by format:
- `png`: 1 to 10 (default 7)
- `webp`: 0 to 6 (default 4)
- `avif`/`heif`/`heic`: 0 to 9 (default 4)
- `avif`/`heif`: 0 to 9 (default 4)
- `jxl`: 3 to 9 (default 7)
- `gif`: 1 to 10 (default 7)

The keywords `"min"` and `"max"` apply the highest effort value for the given image format.
Expand Down Expand Up @@ -168,7 +169,7 @@ import Image from 'exmaple.jpg?flop=true'

### Format

**Keyword**: `format`<br> • **Type**: _heic_\| _heif_ \| _avif_ \| _jpeg_ \| _jpg_ \| _png_ \| _tiff_ \| _webp_ \|
**Keyword**: `format`<br> • **Type**: _jxl_\| _heif_ \| _avif_ \| _jpeg_ \| _jpg_ \| _png_ \| _tiff_ \| _webp_ \|
_gif_<br>

Convert the image into the given format.
Expand All @@ -180,7 +181,7 @@ Convert the image into the given format.

```js
import Image from 'example.jpg?format=webp'
import Images from 'example.jpg?format=webp;avif;heic'
import Images from 'example.jpg?format=webp;avif;jxl'
```

---
Expand Down Expand Up @@ -259,7 +260,7 @@ Use this directive to set a different interpolation kernel when resizing the ima
Use lossless compression mode.

Formats that support this directive are:
`avif`, `heif`, `heic`, and `webp`
`avif`, `heif`, `jxl`, and `webp`

**Example**:

Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/transforms/effort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export interface EffortOptions {
}

const FORMAT_TO_EFFORT_RANGE: Record<string, [number, number]> = {
png: [1, 10],
webp: [0, 6],
avif: [0, 9],
gif: [1, 10],
heif: [0, 9],
heic: [0, 9],
gif: [1, 10]
jxl: [3, 9],
png: [1, 10],
webp: [0, 6]
}

function parseEffort(effort: string, format: string) {
Expand Down

0 comments on commit d57c5d7

Please sign in to comment.