cronshot-imagemagick 介绍
cronshot-imagemagick 是 cronshot 中间件,通过
gm 来操作和保存
ImageMagick 处理的图片。
安装
npm install cronshot-imagemagick
示例
var cronshot = require('cronshot'), middleware = { 'imagemagick': require('cronshot-imagemagick') }; // Image Magick Example // -------------------- // Takes a screenshot of sports.yahoo.com, // and converts the screenshot to be a transparent image using Image Magick // Image Magick example cronshot.startCapturing({ // The webpage URL that you would like to take a screenshot of 'url': 'http://sports.yahoo.com', // The local path where you would like to save the image 'path': __dirname, // Only takes one screenshot 'cronPattern': false, // What middleware functions to use each time a screenshot is taken 'saveMiddleware': [{ // Function that does all the Image Magick stuff 'middleware': middleware.imagemagick, 'options': { 'gmCommands': [{ 'method': 'trim', 'args': [] }, { 'method': 'transparent', 'args': ['#FFFFFF'] }] } }] }, function(err) { // optional callback function once all screenshots have been taken });
cronshot-imagemagick 官网
https://github.com/yahoo/cronshot-imagemagick
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。