0

画像のサイズを変更する必要があるため、以下の 3 つのライブラリで、画像のサイズ変更に時間がかからないライブラリを見つける方法を説明します。

https://github.com/rsms/node-imagemagick

https://github.com/mash/node-imagemagick-native

https://github.com/aheckmann/gm

サンプルコード

     var im = require('imagemagick');
     var sourcePath='/tmp/Images/1.jpeg';
     var destinationPath='/tmp/ResizedImages/resized.png';
     im.resize({
       srcPath: sourcePath,
       dstPath: destinationPath,
       width:   90,
       height:100,
   },function(err,res){


    if(err){


        console.log('Error while resizing image '+err);
        return;
    }

    console.log('Image resized successfully...');


});
4

1 に答える 1

1

私は同じ質問を自分で調査しています。これは、画像のサイズ変更を行うさまざまなソフトウェアのベンチマークです。

http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use

個人的には、https://github.com/aheckmann/gmライブラリを使用することをお勧めします。これによると、imagemagick よりも約 1.5 倍から 5 倍高速に実行されるからです。

http://www.admon.org/graphicsmagick-vs-imagemagick/ (cant post more than two links. reputation)

幸運なことに、私は自分で Graphicsmagick を選びました。

于 2013-07-16T11:30:47.307 に答える