code: function (callback) {
               gm(input).identify("%p ", function (err, value) {
                  var pageCount = String(value).split(' ');
  
                  if (!pageCount.length) {
                      callback({
                          result: 'error',
                          message: 'Invalid page number.'
                      }, null);
                  } else {
                      // Convert selected page
                      if (options.page !== null) {
                          if (options.page <= pageCount.length) {
                              callback(null, [options.page]);
                          } else {
                              callback({
                                  result: 'error',
                                  message: 'Invalid page number.'
                              }, null);
                          }
                      } else  {
                          callback(null, pageCount);
                      }
                  }
  
              })
  
          }
docs: Get pages count