Answers.Body: <p>So, I figured it out by myself. The problem was the anchorpoint. My images were on even pixels but the anchorpoint was odd.</p>
  
  <p>So the solution is to use following expressions:</p>
  
  <pre class="lang-js prettyprint-override"><code>// Position
  newX = Math.round(transform.position[0]);
  newY = Math.round(transform.position[1]);
  [newX, newY]
  
  // Anchorpoint
  newX = Math.round(transform.anchorpoint[0]);
  newY = Math.round(transform.anchorpoint[1]);
  [newX, newY]
  </code></pre>
  
  <p>UPDATE 2</p>
  
  <p>Since I use this expression everytime now I am animating motion graphics, I thought it would be cool to make an actual after effects script of it. You can purchase it here:
  <a href="http://videohive.net/item/fixl-snap-layers-to-pixel/14403309" rel="nofollow">FIXL -Snap Layers to Pixel</a></p>
  
  <p>UPDATE</p>
  
  <p>When you try to animate layers with these expressions, it comes to rough animations. That's why I wrote a new expression that only applies if a keyframe is set. So its safe that whenever an image or layer is resting on the same position for a longer time, it will stay on even pixels.</p>
  
  <p>Add this Expression to the position property of your layer:</p>
  
  <pre class="lang-js prettyprint-override"><code>n = transform.position.numKeys
  t = time;
  timeOfKeyframe = null;
  
  for(i=1; i &lt;= n; i++){
      if ( t == transform.position.key(i).time ){
          timeOfKeyframe = transform.position.key(i).time;
      }
      else{
          value;
      }
  }
  
  if (t == timeOfKeyframe) {
      keyValue = transform.position.valueAtTime(timeOfKeyframe);
      roundedValue = [Math.round(keyValue[0]),Math.round(keyValue[1])];
  }
  else{
      value;
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-23T07:38:54.683Z
Answers.Text: +1 Thanks for sharing your experience!
Answers.UserDisplayName: p2or
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-23T07:29:53.707Z
Answers.LastActivityDate: 2016-01-23T17:13:44.190Z
Answers.LastEditDate: 2016-01-23T17:13:44.190Z
Answers.UserDisplayName: Marten Zander
Body: <p>I am jsut working on a new After Effects Project. I have a bunch of images I am working with and I just wondered, why the edges of images are so blurry. </p>
  
  <p>First I thought it might have something to do with the fact that sometimes, images don't lay on whole pixel. So I used an expression to keep them on whole rounded pixels. BUT! even when they are laying on whole pixels, they have unsharp edges.</p>
  
  <p>My Question is, is there any Opportunity to fix that and in case you know how, could you please tell me?</p>
  
  <p>Thanks in advance!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-22T14:29:57.287Z
Comments.Text: Could you please add an image to your question?
Comments.UserDisplayName: p2or
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-22T15:33:36.593Z
Comments.Text: @poor I think I found the reason. Position was on even pixels but anchorpoint wasn't.
Comments.UserDisplayName: Marten Zander
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-22T15:34:48.417Z
Comments.Text: Ok, would be nice if you could write an answer.
Comments.UserDisplayName: p2or
Tags: <after-effects><after-effects-expressions>
Title: After Effects: Images on whole pixel still blurry edges
UserDisplayName: Marten Zander
ThreadText: # After Effects: Images on whole pixel still blurry edges
  
  (Asked by: username_0 on 2015-04-22)
  
  I am jsut working on a new After Effects Project. I have a bunch of images I am working with and I just wondered, why the edges of images are so blurry.
  
  First I thought it might have something to do with the fact that sometimes, images don't lay on whole pixel. So I used an expression to keep them on whole rounded pixels. BUT! even when they are laying on whole pixels, they have unsharp edges.
  
  My Question is, is there any Opportunity to fix that and in case you know how, could you please tell me?
  
  Thanks in advance!
  
  **Tags:** after-effects, after-effects-expressions
  
  > **Comments:**
  > **username_1**: Could you please add an image to your question?  
  > **username_0**: @poor I think I found the reason. Position was on even pixels but anchorpoint wasn't.  
  > **username_1**: Ok, would be nice if you could write an answer.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-04-23. Score: 3
  
  So, I figured it out by myself. The problem was the anchorpoint. My images were on even pixels but the anchorpoint was odd.
  
  So the solution is to use following expressions:
  
  ```js
  // Position
  newX = Math.round(transform.position[0]);
  newY = Math.round(transform.position[1]);
  [newX, newY]
  
  // Anchorpoint
  newX = Math.round(transform.anchorpoint[0]);
  newY = Math.round(transform.anchorpoint[1]);
  [newX, newY]
  
  ```
  
  UPDATE 2
  
  Since I use this expression everytime now I am animating motion graphics, I thought it would be cool to make an actual after effects script of it. You can purchase it here:
  [FIXL -Snap Layers to Pixel](http://videohive.net/item/fixl-snap-layers-to-pixel/14403309)
  
  UPDATE
  
  When you try to animate layers with these expressions, it comes to rough animations. That's why I wrote a new expression that only applies if a keyframe is set. So its safe that whenever an image or layer is resting on the same position for a longer time, it will stay on even pixels.
  
  Add this Expression to the position property of your layer:
  
  ```js
  n = transform.position.numKeys
  t = time;
  timeOfKeyframe = null;
  
  for(i=1; i <= n; i++){
      if ( t == transform.position.key(i).time ){
          timeOfKeyframe = transform.position.key(i).time;
      }
      else{
          value;
      }
  }
  
  if (t == timeOfKeyframe) {
      keyValue = transform.position.valueAtTime(timeOfKeyframe);
      roundedValue = [Math.round(keyValue[0]),Math.round(keyValue[1])];
  }
  else{
      value;
  }
  
  ```
  
  > **Comments:**
  > **username_1**: +1 Thanks for sharing your experience!  
  
  ---
  
  