Set max-height on image transforms? Is it possible to define an aspect ratio / set a max height on an image transform, without using a plugin?

Let's say the width is fixed to 600px, but the height can be any value up to 800px?
You can pass an array instead of the image-transform handle to the getUrl() function 

{% set transform = {
    'width' =&gt; 600,
    'height' =&gt; (asset.getWidth() &lt;= 800)? asset.getWidth() : 800
} %}
{{ asset.getUrl(transform) }}