-
Notifications
You must be signed in to change notification settings - Fork 89
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
063dfc9
commit 62f16c2
Showing
5 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 @@ | ||
{ | ||
"name": "import_example_ts", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"dependencies": { | ||
"pureimage": "^0.4.13" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.2.2" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "node build/basic.js" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
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,14 @@ | ||
import * as PImage from "pureimage"; | ||
import * as fs from "fs"; | ||
const img1 = PImage.make(100, 100); | ||
const ctx = img1.getContext("2d"); | ||
ctx.fillStyle = "red"; | ||
ctx.fillRect(0, 0, 100, 100); | ||
|
||
PImage.encodePNGToStream(img1, fs.createWriteStream("out.png")) | ||
.then(() => { | ||
console.log("wrote out the png file to out.png"); | ||
}) | ||
.catch((e) => { | ||
console.log("there was an error writing", e); | ||
}); |
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,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./build" | ||
}, | ||
"include": ["src"] | ||
} |