【发布时间】:2017-03-31 17:44:44
【问题描述】:
我正在尝试查看我的公司是否可以使用 Azure Functions 将 TIFF 文件自动转换为多种 JPG 和 PNG 格式和大小。我在 Node.js 中使用 Functions,但也可以使用其他语言。
我的问题是,我无法让 GraphicsMagick 或 ImageMagick 处理函数。我使用 npm install 使用正常的安装程序。
似乎安装正常,并且模块似乎也加载了,但是当我尝试处理文件时没有任何反应。什么都没有,因为也没有错误。
var fs = require('fs'); var gm = require('gm');
module.exports = function (context, req) { context.log('开始...');
try { context.log('Looking for GM...'); context.log(require.resolve("gm")); } catch(e) { console.log("GM is not found"); process.exit(e.code); } gm('D:/home/site/wwwroot/HttpTriggerJS1/input/870003-02070-main-nfh.jpg') .resize(240, 240) .noProfile() .write('D:/home/site/wwwroot/HttpTriggerJS1/output/resize.jpg', function (err) { context.log('TEST'); if (!err) { context.log('done'); } } ); context.done(null, res); };
我不确定这是否可能,但我没有找到任何说明它不能的信息。
那么,我可以在 Functions 中使用 ImageMagick、GraphicsMagick 或第三个图像转换器吗?如果是,安装时我需要注意什么特别的事情吗?
是否还有 C# 解决方案?
【问题讨论】:
-
c# 版本如果可能会更好
-
Cloudinary API 可用于从他们的页面
currently supports the following formats: JPG, PNG, GIF, BMP, TIFF, ICO, PDF, EPS, PSD, SVG, WebP, JXR, and WDP进行图像转换cloudinary.com/cookbook/converting_an_image_format
标签: node.js azure imagemagick graphicsmagick azure-functions