Use Imager plugin with Element API? I'm trying to use the Imager-Craft plugin to make specific image transformations, but cannot figure out how to access Imager within the element-api.php file.

Imager shows plenty of template examples, but I'm not sure how to translate template code like this into straight Element API php.

{% set image = craft.assets().one() %}
{% set transformedImage = craft.imager.transformImage(image, { width: 1000 }) %}
&lt;img src="{{ transformedImage.url }}"&gt;```


Specifically, I'm trying to access that craft.imager.transformImage function.

Is this possible?
In yii2 every instance of a module is stored in a public static property of the main class.

If the plugin is called image you can grab it via

Imager::getInstance()


This instance contains all the required components. The imager plugin it has 3 components

$this-&gt;setComponents([
    'imager' =&gt; ImagerService::class,
    'placeholder' =&gt; PlaceholderService::class,
    'color' =&gt; ImagerColorService::class,
]);


You can access those via Imager::getInstance()-&gt;imager or placeholder or color in this case the instance of the plugin is also stored in a static $plugin variable. You can call 

Imager::$plugin-&gt;imager


as well. You can see a working example here

use aelvan\imager\Imager as Plugin;
.... 
return Plugin::$plugin-&gt;imager-&gt;isAnimated($asset);


This is the function that is being called when you do craft.imager.transform -> the PHP equivalent what you want to do