Answers.Body: <p>No.</p>
  
  <p>A transform can only be applied to an <a href="http://buildwithcraft.com/docs/templating/assetfilemodel" rel="nofollow">AssetFileModel</a>, and there is no AssetFileModel for a random image.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-30T19:52:45.447Z
Answers.LastActivityDate: 2014-06-30T19:52:45.447Z
Answers.UserDisplayName: Marion Newlevant
Answers.Body: <p>While <em>transforms</em> are an asset-only feature, you can get at all of the underlying image manipulation features pretty easily using the ImagesService.</p>
  
  <pre><code>$image = craft()-&gt;images-&gt;loadImage($imageSource);
  $image-&gt;setQuality($quality);
  $image-&gt;resize($transform-&gt;width, $transform-&gt;height);
  $image-&gt;saveAs($targetFile);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-30T21:41:28.817Z
Answers.Text: and that pretty much sums up why i love craft!!
Answers.UserDisplayName: Ben Croker
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-01T14:42:45.240Z
Answers.Text: Lovely! Looks like I just need a quick plugin to do this from Twig.
Answers.UserDisplayName: Tim Kelty
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-08T12:21:59.870Z
Answers.Text: Any pointers on how I could get the two other transform parameters to work? `mode` and `position`
Answers.UserDisplayName: peirix
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-09T00:20:49.907Z
Answers.Text: @peirix Not sure I’m following - probably worth posting as a new question.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-10T20:01:41.483Z
Answers.Text: @BrandonKelly I actually figured it out. What I was after was a way to send in `width`, `height`, `quality`, `mode` and `position`, like I would do with a regular assets transform. But I found that the `$image` will have both `scaleAndCrop` (which will take `position`) and `scaleToFit`.
Answers.UserDisplayName: peirix
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-30T21:05:51.887Z
Answers.LastActivityDate: 2014-06-30T21:05:51.887Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>Curious if I'm able to use the resizer on a random, sourced image, not coming from a field anywhere.</p>
  
  <p>So I would just be passing a string to the path of the image.</p>
  
Tags: <templating>
Title: Can I apply an image transformation to an arbitrary image (non-Assets field)?
ThreadText: # Can I apply an image transformation to an arbitrary image (non-Assets field)?
  
  (Asked by: username_0 on 2014-06-30)
  
  Curious if I'm able to use the resizer on a random, sourced image, not coming from a field anywhere.
  
  So I would just be passing a string to the path of the image.
  
  **Tags:** templating
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-06-30. Score: 12 | Accepted answer
  
  While *transforms* are an asset-only feature, you can get at all of the underlying image manipulation features pretty easily using the ImagesService.
  
  ```
  $image = craft()->images->loadImage($imageSource);
  $image->setQuality($quality);
  $image->resize($transform->width, $transform->height);
  $image->saveAs($targetFile);
  
  ```
  
  > **Comments:**
  > **username_3**: and that pretty much sums up why i love craft!!  
  > **username_0**: Lovely! Looks like I just need a quick plugin to do this from Twig.  
  > **username_4**: Any pointers on how I could get the two other transform parameters to work? `mode` and `position`  
  > **username_2**: @username_4 Not sure I’m following - probably worth posting as a new question.  
  > **username_4**: @username_2 I actually figured it out. What I was after was a way to send in `width`, `height`, `quality`, `mode` and `position`, like I would do with a regular assets transform. But I found that the `$image` will have both `scaleAndCrop` (which will take `position`) and `scaleToFit`.  
  
  ---
  
  ### Answer by username_1 on 2014-06-30. Score: 3
  
  No.
  
  A transform can only be applied to an [AssetFileModel](http://buildwithcraft.com/docs/templating/assetfilemodel), and there is no AssetFileModel for a random image.
  
  
  ---
  
  