Files: c5c7a8ffadbd51aa28a5f3f096fe43f69405da44 / test / test-79-npm / gm / gm.js
438 bytesRaw
1 | ; |
2 | |
3 | var fs = require('fs'); |
4 | var path = require('path'); |
5 | var gm = require('gm').subClass({ imageMagick: true }); |
6 | |
7 | var input = path.join(__dirname, 'piechart.png'); |
8 | var inputStream = fs.createReadStream(input); |
9 | var output = 'piechart-resize.png'; |
10 | |
11 | gm(inputStream).resize(240, 240).write(output, function (error) { |
12 | if (error) throw error; |
13 | if (fs.existsSync(output)) { |
14 | fs.unlinkSync(output); |
15 | console.log('ok'); |
16 | } |
17 | }); |
18 |
Built with git-ssb-web