title: ImageMagick - calculate perspective without knowing image dimensions
body: <p>How can I get the maximum width and height of an image, perform some maths on it, then use it in my perspective distortion?</p>
  
  <p>I have a bunch of images to which I want to apply a perspective distortion.</p>
  
  <p>The only problem is, each image is a different size.</p>
  
  <p>This code works on an image where I know the size (1440 * 900).</p>
  
  <pre><code>convert test.jpg -matte \ 
      -virtual-pixel transparent \ 
      -distort Perspective '0,0        75,0 \ 
                            0,900      0,450 \ 
                            1440,0     1440,200 \ 
                            1440,900   1200,900' \ 
      distorted.jpg
  </code></pre>
  
  <p>I know I can get the maximum values by using <code>%h</code> and <code>%w</code> - but I can't find a way to multiply those numbers.</p>
  
  <p>Essentially, what I want to do is define the points like this:</p>
  
  <pre><code>    -distort Perspective '0,0        75,0 \ 
                            0,%h       0,(%h/2) \ 
                            %w,0       %w,200 \ 
                            %w,%h      (%w*0.75),%h'
  </code></pre>
  
  <p>For bonus points, I'd like to be able to call the perspective using <code>-distort Perspective '@points.txt'</code></p>