I put a little time into this for you, it's not perfect but you can get some insight on it.
In code you will need to size the frame via the WIDTH and the aspect will take over.
With the mouse, you can grab the corners for a fast size or the middle bottom which presents a little problem and that
is you need to move slowly; I didn't have enough time to do it better.
Maybe someone else can make the bottom drag enable faster move because I used a "hittest" and if you move the mouse too fast, it loses its hit position and snaps back.
There are other ways to do this but, the math is there to properly calculate the sizes.
Also, I showed how to stretch the Timage for you.
Attached is the project