generated from napi-rs/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
5ca9fde
commit 11e04a5
Showing
5 changed files
with
131 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { promises } = require('fs') | ||
const { join } = require('path') | ||
|
||
const { createCanvas, Image } = require('../index') | ||
|
||
const canvas = createCanvas(1024, 768) | ||
|
||
const ctx = canvas.getContext('2d') | ||
|
||
async function main() { | ||
const file = await promises.readFile(join(__dirname, 'tiger.png')) | ||
const image = new Image() | ||
image.src = file | ||
// console.log(image, image.width, image.height) | ||
// ctx.drawImage(image, 0, 0) | ||
|
||
const output = await canvas.png() | ||
await promises.writeFile(join(__dirname, 'tiger-tmp.png'), output) | ||
} | ||
|
||
main() |
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
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