Skip to content

Commit

Permalink
docs: example add avif fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
yisibl committed Oct 25, 2021
1 parent f3ea4b8 commit 50bd88a
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Font './example/SourceHanSerifCN-Light-subset.ttf':0 found in 0.006ms.
✨ Done in 55.65491008758545 ms
```

| SVG | PNG |
| ---------------------------------------- | -------------------------------------------- |
| <img width="390" src="example/anime_girl.svg"> | <img width="390" src="example/out-resvg-js.png"> |
| <img width="390" src="example/text.svg"> | <img width="390" src="example/text-out.png"> |
| SVG | PNG |
| ---------------------------------------------- | ------------------------------------------------------------------- |
| <img width="500" src="example/anime_girl.svg"> | <img width="500" src="example/out-resvg-js.png" alt="Anime girl" /> |
| <img width="500" src="example/text.svg"> | <img width="500" src="example/text-out.png"> |

## Benchmark

Expand Down Expand Up @@ -81,8 +81,6 @@ Running "resize width" suite...

## Develop requirements



## Test in local

- Install latest `Rust`
Expand All @@ -94,6 +92,7 @@ yarn
yarn build
yarn test
```

## Roadmap

I will consider implementing the following features, if you happen to be interested,
Expand All @@ -104,6 +103,7 @@ please feel free to discuss with me or submit a PR.
- [ ] Support for generating more lossless bitmap formats, e.g. avif, webp, JPEG XL
- [ ] Support async API (dependent on [napi-rs PR #760](https://github.com/napi-rs/napi-rs/pull/760))
- [ ] Support WebAssembly(.wasm)

## Release package

We use GitHub actions to automatically publish npm packages.
Expand Down
6 changes: 3 additions & 3 deletions example/compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function main() {
const pngData = render(svgString, {
fitTo: {
mode: 'width',
value: 2104,
value: 1052,
},
font: {
loadSystemFonts: false, // It will be faster to disable loading system fonts.
Expand All @@ -24,8 +24,8 @@ async function main() {
console.log('✨ resvg-js done in', t1 - t0, 'ms')
await fs.writeFile(join(__dirname, './out-resvg-js.png'), pngData)

sharpToPng('example/anime_girl.svg', 2104)
skrCanvas(svg, 2104, 1488)
sharpToPng('example/anime_girl.svg', 1052)
skrCanvas(svg, 1052, 744)
}

async function sharpToPng(file, width) {
Expand Down
Binary file modified example/out-resvg-js.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/out-resvg-js@2x.avif
Binary file not shown.
Binary file added example/out-resvg-js@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/out-sharp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/out-sharp@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/out-skr-canvas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/out-skr-canvas@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 50bd88a

Please sign in to comment.