<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Node-gmNode.js 圖像處理包

          聯(lián)合創(chuàng)作 · 2023-09-23 16:37

          gm 是 Node.js 的 GraphicsMagickImageMagick

          常規(guī)使用:

          var fs = require('fs')
            , gm = require('./gm');
          
          // resize and remove EXIF profile data
          gm('/path/to/my/img.jpg')
          .resize(240, 240)
          .noProfile()
          .write('/path/to/resize.png', function (err) {
            if (!err) console.log('done');
          });
          
          // obtain the size of an image
          gm('/path/to/my/img.jpg')
          .size(function (err, size) {
            if (!err)
              console.log(size.width > size.height ? 'wider' : 'taller than you');
          });
          
          // output all available image properties
          gm('/path/to/img.png')
          .identify(function (err, data) {
            if (!err) console.log(data)
          });
          
          // pull out the first frame of an animated gif and save as png
          gm('/path/to/animated.gif[0]')
          .write('/path/to/firstframe.png', function (err) {
            if (err) console.log('aaw, shucks');
          });
          
          // auto-orient an image
          gm('/path/to/img.jpg')
          .autoOrient()
          .write('/path/to/oriented.jpg', function (err) {
            if (err) ...
          })
          
          // crazytown
          gm('/path/to/my/img.jpg')
          .flip()
          .magnify()
          .rotate('green', 45)
          .blur(7, 3)
          .crop(300, 300, 150, 130)
          .edge(3)
          .write('/path/to/crazy.jpg', function (err) {
            if (!err) console.log('crazytown has arrived');
          })
          
          // annotate an image
          gm('/path/to/my/img.jpg')
          .stroke("#ffffff")
          .drawCircle(10, 10, 20, 10)
          .font("Helvetica.ttf", 12)
          .drawText(30, 20, "GMagick!")
          .write("/path/to/drawing.png", function (err) {
            if (!err) console.log('done');
          });
          
          // creating an image
          gm(200, 400, "#ddff99f3")
          .drawText(10, 50, "from scratch")
          .write("/path/to/brandNewImg.jpg", function (err) {
            // ...
          });

           

          瀏覽 17
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  黄色大片免费在线观看 | 日本三级乱伦视频 | 操屄视频免费观看 | 色色色色色色五月婷婷 | 青青草视频手机华人 |