Answers.Body: <p>The size in pixels is easily computed as the source's original dimensions multiplied by the scale. Or in other words </p>
  
  <pre><code>p = d × s
  </code></pre>
  
  <p>where p=pixel dimensions required, d=source dimensions, s=scale.</p>
  
  <p>So to set the scale so that it takes a given source and makes it conform to a desired dimensions:</p>
  
  <pre><code>s = p / d
  </code></pre>
  
  <p>In an expression on the scale property you'd use</p>
  
  <pre><code>var p = [123, 456]; / desired output dimension
  [ p[0] / width, p[1] / height ] * 100; // the *100 is because scale is a percentage
  </code></pre>
  
  <p>To be really fancy you could repurpose the scale value input so that it controlled the pixel dimensions. This means if you want the layer's dimension to be [123,456] you'd just dial it in in the scale control:</p>
  
  <pre><code>var d = value; //returns the pre-expression value of the property
  [ p[0] / width, p[1] / height ] * 100
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-23T01:52:56.033Z
Answers.LastActivityDate: 2017-08-23T01:52:56.033Z
Answers.UserDisplayName: stib
Body: <p>You can right click on a scale, hit Edit, and then enter scale in Pixels, inches , % of Comp, of source.... </p>
  
  <p>I would like to set the scale in pixels. How can set the units using expressions?</p>
  
  <p>I tried returning <code>["200px","200px"]</code>, but that is an error.</p>
  
Tags: <after-effects><after-effects-expressions><after-effects-scripting>
Title: set scale in pixels in After Effects using Expressions
UserDisplayName: sanjihan
ThreadText: # set scale in pixels in After Effects using Expressions
  
  (Asked by: username_0 on 2017-08-22)
  
  You can right click on a scale, hit Edit, and then enter scale in Pixels, inches , % of Comp, of source....
  
  I would like to set the scale in pixels. How can set the units using expressions?
  
  I tried returning `["200px","200px"]`, but that is an error.
  
  **Tags:** after-effects, after-effects-expressions, after-effects-scripting
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-08-23. Score: 2 | Accepted answer
  
  The size in pixels is easily computed as the source's original dimensions multiplied by the scale. Or in other words
  
  ```
  p = d × s
  
  ```
  
  where p=pixel dimensions required, d=source dimensions, s=scale.
  
  So to set the scale so that it takes a given source and makes it conform to a desired dimensions:
  
  ```
  s = p / d
  
  ```
  
  In an expression on the scale property you'd use
  
  ```
  var p = [123, 456]; / desired output dimension
  [ p[0] / width, p[1] / height ] * 100; // the *100 is because scale is a percentage
  
  ```
  
  To be really fancy you could repurpose the scale value input so that it controlled the pixel dimensions. This means if you want the layer's dimension to be [123,456] you'd just dial it in in the scale control:
  
  ```
  var d = value; //returns the pre-expression value of the property
  [ p[0] / width, p[1] / height ] * 100
  
  ```
  
  
  ---
  
  