1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        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)
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            精品国产精品国产自在久国产 | 免费无码A片 | 找个操逼网站 | 日本黄色视频在线观看 | 蜜桃臀久久久蜜桃臀久久久蜜桃臀 | 亲嘴还扔衣服亲脖子 | 男人舔女人下面高潮 | 女男看片黄全部免费 | 91豆花视频18 | 国产成人精品午夜福利Av免费 |