title: NodeJS gm getting image size synchronously
body: <p>I'm using gm and trying to process images according to it's size.
  Since "size" getter needs callback function, I can't use size in following lines.</p>
  
  <p>What I want to do is like that:</p>
  
  <pre><code>function processImage(url) {
      var img = gm(this.getImgStream(url));
  
      var width, height;
      img.size(function(err, val) {
          width = val.width;
          height = val.height;
      });
  
      // I want to use width here, but it's undefined when this line is executed.
      if (width &gt; 500) width = 500;
      return img.resize(width)
  }
  </code></pre>
  
  <p>I want to use width in following resize method. Is there any way to get size synchronously or wait for a callback to complete? I don't want to use ivars as long as possible.</p>