The task having an image with a completely random resolution, make an image with an aspect ratio of 9:16. Ie in some cases, just change the size if the original proportions differ slightly, in others to add frames. For example, if a photo has an aspect ratio of 16:9, it is necessary to change its size and add the top and bottom of the wide white frame.
I focused on the possibility of gm
in the library, but it does not provide the algorithm implementation, only the tools - crop, resize and much more.
I would like to know if there is a ready tool that changes the aspect ratio of the photo? The programming language is not particularly important. Of course, it better be nodejs, but python or php also can be considered. (the main thing that can be run from the node (eg. using exec( ) )