0

我使用命令npm install imagemagick-native安装了node-imagemagick-native 模块安装成功,日志如下

C:\Users\xz\Downloads\test\examples>npm install imagemagick-native

> imagemagick-native@1.8.0 install C:\Users\xz\Downloads\test\examples\node_modules\imagemagick-native
> node-gyp rebuild


C:\Users\xz\Downloads\test\examples\node_modules\imagemagick-native>if not defined npm_config_node_gyp (node "C:\Users\xz\AppData\Roaming\nvm\v0.12.7\node_modules\npm\bin
\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  imagemagick.cc
c:\program files\imagemagick-6.8.5-q16\include\magick/pixel-accessor.h(163): warning C4244: 'argument' : conversion from 'double' to 'const MagickCore::MagickRealType',
possible loss of data [C:\Users\xz\Downloads\test\examples\node_modules\imagemagick-native\build\imagemagick.vcxproj]
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:
\Users\xz\Downloads\test\examples\node_modules\imagemagick-native\build\imagemagick.vcxproj]
..\src\imagemagick.cc(131): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\xz\Downloads\test\examples\node_modu
les\imagemagick-native\build\imagemagick.vcxproj]
..\src\imagemagick.cc(304): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\xz\Downloads\test\examples\node_modu
les\imagemagick-native\build\imagemagick.vcxproj]
..\src\imagemagick.cc(344): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\xz\Downloads\test\examples\node_modu
les\imagemagick-native\build\imagemagick.vcxproj]
..\src\imagemagick.cc(364): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\xz\Downloads\test\examples\node_modu
les\imagemagick-native\build\imagemagick.vcxproj]
..\src\imagemagick.cc(405): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\xz\Downloads\test\examples\node_modu
les\imagemagick-native\build\imagemagick.vcxproj]
..\src\imagemagick.cc(572): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\xz\Downloads\test\examples\node_modu
les\imagemagick-native\build\imagemagick.vcxproj]
..\src\imagemagick.cc(742): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\xz\Downloads\test\examples\node_modu
les\imagemagick-native\build\imagemagick.vcxproj]
..\src\imagemagick.cc(817): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\xz\Downloads\test\examples\node_modu
les\imagemagick-native\build\imagemagick.vcxproj]
..\src\imagemagick.cc(890): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local<T> NanNew<v8::String,char*>(A0)' [C:\Users\x
z\Downloads\test\examples\node_modules\imagemagick-native\build\imagemagick.vcxproj]
          with
          [
              T=v8::String,
              A0=char *
          ]
          but the regular function 'v8::Local<T> NanNew(const char *)' is a better match
          with
          [
              T=v8::String
          ]
          if you expect 'v8::Local<T> NanNew(const char *)' to be called then you need to make it an explicit specialization
          with
          [
              T=v8::String
          ]
  win_delay_load_hook.c
     Creating library C:\Users\xz\Downloads\test\examples\node_modules\imagemagick-native\build\Release\imagemagick.lib and object C:\Users\xz\Downloads\test\examples\no
  de_modules\imagemagick-native\build\Release\imagemagick.exp
  Generating code
  Finished generating code
  imagemagick.vcxproj -> C:\Users\xz\Downloads\test\examples\node_modules\imagemagick-native\build\Release\\imagemagick.node
PacificCX@0.0.1 C:\Users\xz\Downloads\test\examples
└── imagemagick-native@1.8.0  extraneous


C:\Users\xz\Downloads\test\examples>

现在安装后,我尝试运行示例程序

var imagemagick = require('imagemagick-native');
imagemagick.writeFileSync('image.jpg', imagemagick.convert({
    srcData: fs.readFileSync('before.jpg'),
    format: 'PNG',
    quality: 100 // (best) to 1 (worst)
}));

但是出现以下错误...

在此处输入图像描述

请调查问题并提供帮助。

4

0 回答 0