Is there any ready tool to crop the photo to a ratio of a certain aspect ratio?

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( ) )
April 19th 20 at 12:36
1 answer
April 19th 20 at 12:38
There are sharp, covers most of the tasks

Find more questions by tags PhotosNode.js