K
K
kr_ilya2020-04-17 21:41:26
Node.js
kr_ilya, 2020-04-17 21:41:26

Is there a ready-made tool to crop photos to a specific aspect ratio?

The task, having an image with a completely random resolution, is to make an image out of it with an aspect ratio of 9:16. That is, in some cases, just change the size, if the original proportions differ slightly, in others - add frames. For example, if the photo has an aspect ratio of 16:9, then you need to resize it and add wide white borders at the top and bottom.

Example

5e99f6033d42b017801675.jpeg


I am aiming at the capabilities of the gm library, but it does not provide the implementation algorithm itself, only tools - crop, resize and much more.

I would like to know if there is a ready-made tool that changes the aspect ratio of a photo? In this case, the programming language is not particularly important. Of course, it is better that it be nodejs, but, say, python or php can also be considered. (the main thing is to be able to execute from the node (for example, using exec( ) )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Makarov, 2020-04-18
@MDiMaI666

There is sharp , covers most tasks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question