You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
406 B
14 lines
406 B
var fs = require('fs')
|
|
var path = require('path')
|
|
var Canvas = require('..')
|
|
|
|
var Image = Canvas.Image
|
|
var canvas = new Canvas(288, 288)
|
|
var ctx = canvas.getContext('2d')
|
|
|
|
var img = new Image()
|
|
img.src = fs.readFileSync(path.join(__dirname, 'images', 'grayscaleImage.jpg'))
|
|
|
|
ctx.drawImage(img, 0, 0)
|
|
|
|
canvas.createJPEGStream().pipe(fs.createWriteStream(path.join(__dirname, 'passedThroughGrayscale.jpg')))
|
|
|